Trying to count the total number of paragraphs inside a blog article

I’m pretty sure that is_singular() is going to return false when you are inside the WP loop, since there are more than one posts being looped through. Try is_single() or just look at the post object and examine the post_type attribute. add_filter( ‘the_content’, ‘_some_func’, 15 ); function _some_func( $content ) { if( __check_paragraph_count_blog( $content ) … Read more

Placing the_content inside shortcode not working

It doesn’t appear that the variable $the_content exists. I’m guessing what you want is the function the_content(), but since that actually echoes its output, that won’t work either. You need to use the function get_the_content() which will return the output (as opposed to echoing it). Try this: echo do_shortcode(‘[wcm_restrict plans=”silver”]’ . get_the_content() . ‘[/wcm_restrict]’);

How to get total number of shortcodes in the wordpress application?

Create a new page in WordPress theme and use below code : <?php global $shortcode_tags; echo ‘<pre>’; print_r($shortcode_tags); echo ‘</pre>’; ?> For details see link and another post may helps! For specific to your requirements use below code in functions.php then use shortcode [all_shortcodes] in your page or sidebar to list shortcodes: add_shortcode(‘all_shortcodes’, ‘all_shortcodes_display’); function … Read more

How to use div class between the shortcode variable?

It’s a bit difficult to understand or provide an accurate answer as we don’t know what the shortcode is executing. Is it stripping html or any other parsing? If this is your own code, then you could add it in the function the shortcode is calling. If its not you could try a couple options: … Read more

Remove Shortcode […] from Blog Preview

You can do with PHP. Just remove part where is get_content() and add this: <?php $content=get_the_content(); $content = preg_replace(‘#\[[^\]]+\]#’, ”,$content); echo apply_filters(‘the_content’, $content); ?> That is regular expression added inside content. This regex will remove all tags inside content.