How to return loop contents

There are replacements that return pure strings for all parts, no need to print anything into an output buffer. I like sprintf() and would write your example like this: <?php if ( $cms_pl_pages->have_posts() ) { $content=”<section class=”cms-pl-gallery”>”; while ( $cms_pl_pages->have_posts() ) { $cms_pl_pages->the_post(); $content .= sprintf( ‘<article class=”cms-pl-item clearfix”> %1$s <h2> <a href=”https://wordpress.stackexchange.com/questions/57000/%2$s” title=”Read %3$s”>%4$s</a> … Read more

How can i put an array as variable in shortcode_atts?

Ok found a solution function product_gallery_shortcode($atts) { extract(shortcode_atts(array( ‘product_id’ => ’31’, ‘prodvid’ => false, ‘youtubeids’=> ”, ‘thumbnr’ =>2 ), $atts)); etc and i had to turn youtubeids into an array again $youtubeidsnew = array(); $youtubeidsnew = explode(‘,’, $youtubeids);

Remove wptexturize from a shortcode?

There is a clue in wp-includes/formatting.php in the function wptexturize: $default_no_texturize_shortcodes = array(‘code’); … $no_texturize_shortcodes=”(” . implode(‘|’, apply_filters(‘no_texturize_shortcodes’, $default_no_texturize_shortcodes) ) . ‘)’; Try using this filter to add a shortcode to the array: function my_no_tex( $shortcodes ) { $shortcodes[] = ‘someshortcode’; return $shortcodes; } add_filter( ‘no_texturize_shortcodes’, ‘my_no_tex’ );

Shortcode in shortcode: How to append variable?

You need to get the attributes of the shortcode, which is quite simple and documented in the add_shortcode() examples: function wrapthecode( $attr ) { if( empty( $attr[‘id’] ) ) return ‘No ID given.’; return do_shortcode(‘[contact-form-7 id=”‘ . $attr[‘id’] . ‘”]’); } add_shortcode( ‘myform’, ‘wrapthecode’ );

short code output too early

A shortcode has to return just a string, you should not print something like in wp_list_pages() or echo. From Shortcode API: The return value of a shortcode handler function is inserted into the post content output in place of the shortcode macro. Remember to use return and not echo – anything that is echoed will … Read more

how to include other plugins css files in a shortcode?

I think you could get around this by pre-running the shortcodes on the page by applying the content filters before the header is output. This should allow any internal shortcodes run inside the included post to add any action hooks properly and thus any needed stylesheets/resources. add_action(‘wp_loaded’,’maybe_prerun_shortcodes’); function maybe_prerun_shortcodes() { if (is_page()) { global $post; … Read more

Run visual composer code in php page

Based on Toms comment this will work: <?php echo do_shortcode( ‘ [vc_column_text] <h3><a href=”https://wordpress.stackexchange.com/questions/298984/home”>home</a></h3> [/vc_column_text] ‘ );?>

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