Tag Info

Hot answers tagged

4

Caption shortcode attributes are merged with defaults using shortcode_atts function like so (see source in media.php): $atts = shortcode_atts( array( 'id' => '', 'align' => 'alignnone', 'width' => '', 'caption' => '', 'class' => '', ), $attr, 'caption' ); So the 3rd $shortcode param is in use with the value of 'caption'. As ...


3

Here is how you should create shortcode. First you will have to define $atts item in get_userdata because $atts is an array. Also I think there is also some issues with uppercase attributes names, so you should use attribute in lower case. So instead of userID, use userid. function getUserEmail_func( $atts ) { $user_info = get_userdata( $atts['userid'] ...


2

You should use do_shortcode() function in both strings you are returning it will execute the shortcodes in the string. function oldStuff(){ return do_shortcode(' [new] only raw html is in this function '); } add_shortcode('old', 'oldStuff');


2

Method #1 If available, I would use the: shortcode_atts_{$shortcode} filter to collect the attributes of a given shortcode. Example: $text = ' [gallery] [gallery ids="1,2" link="file"] [gallery ids="3"] [caption id="attachment_6" align="alignright" width="300"] '; if( class_exists( 'WPSE_CollectShortcodeAttributes' ) ) { $o = new ...


1

Your solution has helped me find an answer to my own problem of getting the attribute of a certain shortcode, but I fear there may be an issue with your approach. You're using preg_match to check the post_content, which will only return 1 match. If you have a post that has multiple shortcodes in it, it will only return the first one, which may not be the ...


1

You can use do_shortcode() echo do_shortcode($post_customs["project_items_".$i."_edit_proposal_item"][0]); More : http://codex.wordpress.org/Function_Reference/do_shortcode


1

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 ...



Only top voted, non community-wiki answers of a minimum length are eligible