shorthand syntax for custom fields

You have a couple of flaws in your code get_post_meta( ‘fap_referral_link’ ) should be get_post_meta( $post->ID, ‘fap_referral_link’, true ). Please see get_post_meta() You should always first check if you actually have posts before you run your foreach loop Never ever use extract(). It uses eval() which stand for EVIL. This has been completely removed from … Read more

Different ID in every shortcode

What if you concatenate the string, like $author_ig = ‘[instagram-feed id=”‘ . get_the_author_meta(‘instagram’) . ‘” imageres=”full” showheader=”true” showbutton=”true” buttoncolor=”#fff” buttontextcolor=”#000″ showfollow=”false”]’; echo do_shortcode($author_ig); I used get_the_author_meta instead of the_author_meta, because the former returns the meta as a string while the latter echo’s the meta.

Multiple instances of the shortcode on the same page

I’d expect that the final return do_shortcode($return); is the problem as it tries to process a shortcode named the entire content you are about to return and return a value. I expect that this is not what you are intending there. Try changing that to: return $return; If that does not fix things, then I’d … Read more

WordPress Short code for List style

I finally make it ready after some more research. function coregnie_list_ul( $atts, $content = null ) { extract(shortcode_atts(array( ‘style’ => ‘cg_list’, ), $atts)); return ‘<ul class=cg_list_’.$style.’ >’.do_shortcode($content).'</ul>’; } add_shortcode(‘ul’, ‘coregnie_list_ul’); function coregnie_list_li( $atts, $content = null ) { return ‘<li>’.do_shortcode($content).'</li>’; } add_shortcode(‘li’, ‘coregnie_list_li’);

Modify shortcode to work with custom post types

This part of the code is what defines the arguments that can be passed with the shortcode: extract(shortcode_atts(array( “posts” => ‘8’, “columns” => ‘4’, “category” => ”, “style” => ‘text-normal’, “image_height” => ‘auto’, “show_date” => ‘true’, “excerpt” => ‘true’, ), $atts)); This allows you to later on use this values as $posts, $columns and so … Read more

find shortcode inside content of post

In order to get your shortcode to show up, you have to register it first. This is done with add_shortcode(). You can read more about the Shortcode API in the Codex. Here is an example of a Youtube video-shortcode that accepts 3 parameters; Video ID (from Youtube, the last part of the Youtube url), height … Read more

Shortcode to get featured image of specific id post

Using your example I’ve updated it to return instead of the title the image. function post_shortcode( $atts ) { extract( shortcode_atts( array( ‘id’ => ”, ), $atts ) ); if ( isset( $id ) ) { return ‘<a href=”‘ . get_permalink( $id ) . ‘”>’ . get_the_post_thumbnail( $id, ‘thumbnail’ ) . ‘</a>’; } } add_shortcode( … Read more