How can I display wp_link_pages before a shortcode, if it is used, or display after content?

Do something like this. // your shortcode callback function your_sc_callback($atts,$content) { $content = wp_list_pages(array(‘echo’=>false)).$content; define(‘YOUR_SC_RAN’,true); return $content; } Now, in your theme template after the content prints if (!defined(‘YOUR_SC_RAN’)) { wp_list_pages(); } Or, you could do … function append_list_pages($content) { return $content.wp_list_pages(array(‘echo’=>false)); } add_filter(‘the_content’,’append_list_pages’,100); And your shortcode callback would be … function your_sc_callback($atts,$content) { $content … Read more

Convert usernames listed by the Groups plugin shortcode to displayed names?

Bellow is the adapted function (by 24 rows shorter than the original), as was suggested by the commenters (many thanks!). It will work only if the Groups plugin was installed and activated. add_shortcode( ‘groups_group_info’, ‘groups_group_info’ ); function groups_group_info( $atts, $content = null ) { global $wpdb; $output = “”; $options = shortcode_atts( array( ‘group’ => … Read more

is_mobile as shortcode

You’ve got an extra “;” after if ( !is_mobile( ) ); Your code should look like this: add_shortcode( ‘is_mobile’, ‘is_mobile_shortcode’ ); function is_mobile_shortcode( $atts, $content = null) { if ( !is_mobile( ) ) return $content; return ”; } And you’ll use it in this way (just for to be sure you’re using it right: [is_mobile]My … Read more

shortcodes inside shortcode to sum values

You can try this: add_shortcode(‘sumsc’,’sumsc_func’); function sumsc_func( $atts, $content = null ) { $sum=0; preg_match_all(‘/stat([0-9]+)/i’, $content, $matches); if(isset($matches[1])){ $sum = array_sum($matches[1]); } return do_shortcode($content).” <div>The sum is <strong>”.$sum.”</strong></div>”; } This will add the total sum at the end of the shortcode content. Usage example: You can try this in your editor: [sumsc][stat1 val=”usa”] [stat2 val=”europe”] … Read more

do_shortcode & render custom field won’t work

Are you sure that you are supposed to nest the shortcodes like this? If the following is going to work depends on how the plugin you use handles nested shortcodes. <?php echo do_shortcode(‘[xt_tabs_button] [xt_tab title=”Informatie”] (types_render_field(“informatie”, array(“output”=>”html”))); [/xt_tab] [xt_tab title=”Spelregels”] (types_render_field(“spelregels”, array(“output”=>”html”))); [/xt_tab] [/xt_tabs_button]’); ?> Do you have the docs for this plugin available? The … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)