• Resolved svlearningcurve28

    (@svlearningcurve28)


    You made a suggestion in one of my earlier issues that one could always use do_shortcode(“[ratemypost]”) to control how/where the rating is rendered, which does not appear the case.

    A quick review.

    1. We have a content filter that provides custom content when content is EMPTY.
    2. We have numerous custom post types

    Adding “[ratemypost]” to our custom content for the CPT does nothing.

    The only way I can get ratemypost to show, is to whitelist the custom post type in the “Add rating widget automatically to custom post types” setting.

    But making this setting change causes the content to be automatically MODIFIED BEFORE the custom content filter (which is at priority 1). As the content is now no longer empty, the custom content will never show, defeating the purpose of the content filter.

    Might you have another suggestion work around?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter svlearningcurve28

    (@svlearningcurve28)

    For reference, here is the content filter illustrating what we are trying to do

    function default_for_empty_content($content) {
    	if( is_singular() && is_main_query() ) {
    		if (empty($content) ) {
    			$custom = "";
    			$custom .= "some custom content here";
    			$custom .= "[ratemypost]";  // This does not work
    			return $custom;
    		} 
    	}	
    	return $content;
    }
    add_filter('the_content', 'default_for_empty_content');
    Thread Starter svlearningcurve28

    (@svlearningcurve28)

    Ok, based upon some more testing, it now seems to work (the example code above).

    Not sure why it did not earlier (I suspect some caching in the way).

    Marking this resolved.

    Plugin Support Blaz K.

    (@blazk)

    Happy to hear, you solved the problem.

    Regards,
    Blaz

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘do_shortcode(“[ratemypost]”) does not work on CPTs’ is closed to new replies.