WordPress.org

Ready to get started?Download WordPress

Forums

Comments Evolved for WordPress
disable for a CPT possible? (16 posts)

  1. Martin
    Member
    Posted 1 year ago #

    Hey Brandon,

    I was wondering whether there's a way to exclude using the plugin functionality for a particular Post type?

    You see Woocommerce uses comments in a way to do their product reviews that include their own Star Ratings.

    You can see an example of this at http://www.geekandjock.com/the-geekandjock-shop/how-you-can-have-a-successful-win-win-divorce where my product reviews have reverted to comments including G+ and Disqus etc.

    Obviously this now detracts from the premise of the reviews and makes them look out of place.

    Is there a functions.php snippet I might be able to use to fix this in the short/medium/permanent term, mate?

    http://wordpress.org/extend/plugins/gplus-comments/

  2. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    short term you should be able to edit your theme's comments.php as the plugin just chain loads it to show the native wp comments so that they are styled the same way the theme intended them to be ( thats actually due to your sugestion , well indirectly :P )

    Sooooo yea, let me ponder on the best way to do this properly tho, but yea ...

  3. Martin
    Member
    Posted 1 year ago #

    Hmm OK, I'm not even going to attempt to play around with editing my comments.php - I thought there might have been a functions.php addition that I could have inserted.

    My fat little uneducated fingers would surely cause more trouble than good in messing with php files :)

    I'll need to await your ponderings, methinks

  4. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    the relevant plugin code is


    if (file_exists(TEMPLATEPATH . '/comments.php'))
    {
    include_once TEMPLATEPATH . '/comments.php';
    }
    elseif (file_exists(TEMPLATEPATH . '/includes/comments.php'))
    {
    include_once TEMPLATEPATH . '/includes/comments.php';
    }
    else
    {
    include_once GPLUS_COMMENTS_TEMPLATES . '/native-comments-fallback.php';
    }

    that is from the file /wp-content/plugins/gplus-comments/templates/comments-container.php , so if that file exists it loads it from your theme ( and it does exist for you as that bit of code was the bugfix for your styling issue )

    it should contain logic similar to what i use to grab just the trackbaks for that tab ( they are just comments too like the reviews ) to only include a certain type of comments and/or exclude others ... here is the code that I use to show only trackbacks that you may adopt for your comments.php


    <div id="trackback-tab" class="block content-tab clearfix">
    <?php
    if (!empty($comments_by_type['pings'])) : // let's seperate pings/trackbacks from comments
    $count = count($comments_by_type['pings']); $txt = __('Pings/Trackbacks');
    ?>
    <h6 id="pings"><?php printf( __( '%1$d %2$s for "%3$s"'), $count, $txt, get_the_title() )?></h6>
    <ol class="commentlist">
    <?php wp_list_comments('type=pings&max_depth='); ?>

    <?php else : ?>
    <p class="nopingback">No Trackbacks.</p>
    <?php endif; ?>
    </div> <!--//tb-tab -->

  5. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    I still have the code you sent to me for the other fix, I cant promis anything but I'll peek at it when I have a moment and if possible I'll send you over either a functions.php snippet if possible that way or what exactly to edit in the comments.php

  6. Martin
    Member
    Posted 1 year ago #

    oh thanks so much if you can find some time to do that Brandon. Much appreciated if you can and equally appreciated if you aren't able to as well. Just thankful for a great plugin and what it does for the community

  7. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    it looks like it should be as simple as changing the line in your theme's comments.php that has wp_list_comments(); line and change it to say the following ...


    <?php wp_list_comments('avatar_size=60&type=comment'); ?>

    Make sure and do a backup just before the change, once we're inside its too late, so get started if you like right now, and Ill catch up with you here in a bit :)

  8. Martin
    Member
    Posted 1 year ago #

    well, it already has

    if  ( have_comments() ) : ?>
    
    		<?php
    		if ( ! empty($comments_by_type['comment']) ) : ?>
    
    			<ol class="comment-list">
    				<?php
    				// show individual comments
    				wp_list_comments('callback=mytheme_comment&type=comment');
    				?>
    			</ol>
    
    			<div class="comms-navigation">
    				<div style="float:left"><?php previous_comments_link() ?></div>
    				<div style="float:right"><?php next_comments_link() ?></div>
    			</div>
    			<?php
    		endif;
    
    	endif;

    so that looks to be already covered :(

  9. Martin
    Member
    Posted 1 year ago #

    Well, I had to deactivate the plugin unfortunately.
    My partner wants to run some product advertising and we discovered that not only did the plugin bork the reviews, it also prevented the tab switching to function properly.

    Need to review things once the advertising cycle completes and/or test any changes via localhost settings.

  10. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 1 year ago #

    Yea, i would have to look at how the whole theme is structured because from the code i've seen it should only be showing the comments

    as far as the tab switching, make sure that it is not loading its own copy of jquery-ui-tabs and instead enqueues the one that comes with wordpress

  11. Martin
    Member
    Posted 1 year ago #

    Yeah, all these Addams can certainly be problematic sometimes :)
    I beta test the CommentLuv plugin as well and am waiting on Andy Bailey to get back to me shortly in disabling CL from the Review pages as well :)
    Oh, WooCommerce :)

  12. Daniel J. Lewis
    Member
    Posted 11 months ago #

    Hi, guys! I figured out a way to do this because I had the same problem with Disqus blocking product reviews.

    I documented the process in "how to disable Disqus on WordPress custom post types."

    The process works for the "product" post type, and I'm sure it would work for anything else, too.

  13. Martin
    Member
    Posted 11 months ago #

    So you saying that what is on your webpage for the process completely disables all of this plugins' output?

  14. Brandon Holtsclaw
    Member
    Plugin Author

    Posted 11 months ago #

    Martin,

    I can modify that code a bit ( it would be used in the function comments_evolved_template() in the wp-content/gplus-comments/lib/frontend.php file ) and make it an option to disable the comments on CPT's

    I'll see if I can get the update out in the next 24 hours or so ...

    Thanks for the nudge DJosephDesign

  15. Martin
    Member
    Posted 11 months ago #

    Yeah that'd be cool Brandon.
    I've been meaning to get to re-enbling the plugin and get it 'not working' with CPT but things get in the way ... read procrastination :)

  16. Daniel J. Lewis
    Member
    Posted 11 months ago #

    @Martin,

    I'm sorry. I just realized that I mistook this post for being in the Disqus forum. My technique applies to just Disqus, but it sounds like Brandon is now inspired to incorporate a similar trick into Comments Evolved (which I will now check out).

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.