Support » Plugin: Worth The Read » Not working on a Custom Post Type

  • Resolved FadingMusic

    (@fadingmusic)


    Hello,

    Worth the Read is not working for one of my Custom Post Types, the others are working just fine. This also happens to be the only post type using a custom template of single.php.

    Can someone please help me figure this out?
    Thank you in advance!

    • This topic was modified 3 years, 8 months ago by FadingMusic. Reason: Typo

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 18 total)
  • Thread Starter FadingMusic

    (@fadingmusic)

    I think I might know what the problem is, the WP-Review plugin uses its own text box, instead of the default WP text box. Could this be the problem? If so, is there a workaround?

    Thank you in advance.

    Plugin Author brianmcculloh

    (@brianmcculloh)

    Does the custom post type show in the Worth The Read admin panel as one of the custom post types to turn on? Or does it not even display there either? Thanks.

    Thread Starter FadingMusic

    (@fadingmusic)

    Hello brianmcculloh, and thank you kindly for your support.

    Yes, it shows the Custom Post Type “Review” and it’s enabled. I’ve also made sure to clear both WordPress and browser cache.

    Again, I suspect that your plugins only looks at the WordPress text box, not the text box that is added by the WP-Review plugin.

    Plugin Author brianmcculloh

    (@brianmcculloh)

    Ah yes, that’s what I was afraid of. I just wanted to narrow it down to that at least, which you’ve done.

    So WTR actually interfaces with the_content() which is a standard WP function to display your content. If your custom post type does not use the_content() to display the content, then indeed as you have guessed WTR has nothing to grab ahold of. If we could find out what function the review plugin uses to display content, I could potentially help you add a filter that works with it.

    Thread Starter FadingMusic

    (@fadingmusic)

    Thank you for your great support, I’ll be sure to give your plugin a good rating.
    Looking at the code, I think the following code adds the review metabox:

            	add_meta_box(
            		'wp-review-metabox-desc',
            		__( 'Review Description', 'wp-review' ),
            		'wp_review_render_meta_box_desc',
            		$post_type,
            		'normal',
            		'high'
            	);
    Plugin Author brianmcculloh

    (@brianmcculloh)

    Can you find the code in the page template that actually displays that meta box onto the page?

    Thread Starter FadingMusic

    (@fadingmusic)

    Thank you kindly for your fast reply,

    The template file is basically using single.php with a few non-related modifications, so it should work just fine. I deleted the review-single.php template to test whether it would work or not, but it did not work.

    According to the developer WP-Review is using the_content filter, but that doesn’t seem to be the case.

    WP Review is using ‘the_content’ filter to display review box, if you are not using shortcode to display review box.

    I’m not using the shortcode to display the review box

    https://community.mythemeshop.com/topic/82861-wp-review-about-the_content-filter/

    Plugin Author brianmcculloh

    (@brianmcculloh)

    If you’re comfortable editing a plugin file directly, try editing the worth-the-read.php file (inside the worth-the-read plugin folder) at line 61:

    if ( !empty($types) && is_singular($types)) {

    Try changing it to:

    if ( !empty($types) ) {

    Not sure if that will do it, but it would help to identify the issue.

    Hello,
    Another thing you could try is changing this line in the plugin file worth-the-read.php:
    add_filter( 'the_content', 'wtr_wrap_content', 10, 2 );
    To:
    add_filter( 'the_content', 'wtr_wrap_content', 11, 2 );
    This would add the wrapper element after WP Review added its own content.
    If that doesn’t help, please create a post in our community forums and we will try to find a solution: https://community.mythemeshop.com/forum/11-free-plugin-support/
    Thank you.

    Thread Starter FadingMusic

    (@fadingmusic)

    Thank you kindly for your suggestion, ben,

    Unfortunately, the possible solution you provided did not solve the problem. I also made sure to clear both WordPress and browser caches.

    I’ve already created a post for this, please see > https://community.mythemeshop.com/topic/82861-wp-review-about-the_content-filter/

    Thread Starter FadingMusic

    (@fadingmusic)

    So, if I enable WP text box and put some text in it, the WTR bar will only respond to that, but when I scroll back to the review text, the WTR bar does not appear.

    • This reply was modified 3 years, 8 months ago by FadingMusic. Reason: Correction
    Plugin Author brianmcculloh

    (@brianmcculloh)

    Once again, sounds like the issue lies with the way the review filters the content or adds its main content into the page, unfortunately. Did the other plugin dev have anything helpful?

    Thread Starter FadingMusic

    (@fadingmusic)

    Hi brianmcculloh,

    Unfortunately, no. I’m still figuring things out with the developers. The last thing they wrote is that WP-Review is using the_content filter. > https://community.mythemeshop.com/topic/82861-wp-review-about-the_content-filter/?tab=comments#comment-398786

    I copied the code of filter-list.php to pastebin > https://pastebin.com/FeDwRmWG
    I’m not sure what to look for exactly.

    Hi,

    I have replied in the thread in our community forums with a possible solution: https://community.mythemeshop.com/topic/82861-wp-review-about-the_content-filter/?tab=comments#comment-400144

    Hope that helps.

    Thread Starter FadingMusic

    (@fadingmusic)

    Hi Ben, and thank you for providing a solution.

    However, the code you provided only partially solved the problem, the progress bar works, but the “Min Read” counter is stuck on 1 min read (only for reviews), no matter how much text is written.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘Not working on a Custom Post Type’ is closed to new replies.