get_posts not working on homepage?

The get_posts() argument is supposed to be numberposts not posts_per_page and you were passing it as string. Try making it an integer. function listposts( $atts ) { $atts = shortcode_atts( array( ‘tag’ => ‘jan-2011’, ‘numberposts’ => -1, ‘orderby’ => ‘post_date’, ‘order’ => ‘asc’, ‘post_status’ => ‘any’ ), $atts ); $catposts = get_posts( $atts ); $out=””; … Read more

Shortcodes not working

This is how your shortcode should be set up: function short_birthday( $atts, $content = NULL ) { extract( shortcode_atts( array( ‘year’ => ‘default value’ ), $atts ) ); list( $Y, $m, $d ) = explode( “-“, $year ); $data = date( “md” ) < $m.$d ? date( “Y” )-$Y-1 : date( “Y” )-$Y; return $data; … Read more

How to execute a shortcode?

Well, as Christopher Davis mentioned – do_shortcode works fine with extra stuff included, so I decided to reset my server and echo do_shortcode(get_option(‘my_option’)); started to work perfectly. So I guess the answer has always been here, execute shortcodes with do_shortcode.

How to deal with WordPress bug: can’t use wrapped and unwrapped shortcode on same post

According to a new post by mdawaffe on the trac ticket referenced in this question: [test id=”1″/] first self closed, now [test id=”2″]with content[/test] [foo attr/]bar[foo attr/]bar[/foo] [test/] [test]foobar[/test] [test id=”1″][/test] All these cases now work. Apart from unit tests, this ticket can be closed. I am assuming this means it will not be an … Read more

How to add a shortcode to call a function

So you’re just looking for a simple shortcode that will call an existing function? The following will create the shortcode you’re looking for, but admittedly I haven’t tested it with the Cimy User Extra Fields plugin. Add this to functions.php and try it out: function shortcode_cimyFieldValue( $atts ) { global $current_user; $user_id = ( is_user_logged_in() … Read more