WordPress.org

Support

Support » Themes and Templates » [Resolved] double comments with an event plugin

[Resolved] double comments with an event plugin

  • RolandOfEld

    @rolandofeld

    hi Anthony – I am using Modern Tribe’s The Events Calendar plugin … basically what my problem is that when I enable an event to have the comments enabled on that event, I get 2 comment field/boxes.. obviously I only need the one so I sought out the help of the plugin authors and this is what they replied to me with:

    Hi – you could basically try wrapping the code used in that template to display the comment form (normally this is quite simply a line reading comment_form(); ) in a conditional statement, something like this:

    if ( ! tribe_is_event_query() ) comment_form();

    Does that help here? You might want to make this change in a child theme to prevent your modification from being wiped on a future update – but it would be best to seek the advice of the theme author on that front.
    —-

    I wanted to run this past you as I don’t want to go chopping up php code as I don’t really know php very well.. can you shed some light?

Viewing 13 replies - 1 through 13 (of 13 total)
  • Theme Author Anthony Hortin

    @ahortin

    Do you know what template is being called? Is it one of the templates from Events Calendar?

    Can you post the URL for your site please. Thanks.

    RolandOfEld

    @rolandofeld

    I am using the front page template

    the site is still in construction and isn’t live yet… i am sending you an email via the contact section of the quark website with login credentials so you can take a look

    thanks, i really appreciate it

    RolandOfEld

    @rolandofeld

    hi Anthony.. just wondering if my email arrived to you?

    Theme Author Anthony Hortin

    @ahortin

    I did, thanks. Just haven’t had a chance to look at it, or your site yet, sorry.

    RolandOfEld

    @rolandofeld

    no problem – eagerly awaiting your response

    RolandOfEld

    @rolandofeld

    sorry to be a pain Anthony.. I was hoping to go live soon and I can’t figure this out on my own, (believe me I have tried)

    can you help?

    the current code for the front-page.php is:

    get_header(); ?>
    
    	<div id="primary" class="site-content row" role="main">
    		<div class="col grid_12_of_12">
    
    			<?php if ( have_posts() ) : ?>
    
    				<?php while ( have_posts() ) : the_post(); ?>
    					<?php get_template_part( 'content', 'page' ); ?>
    					<?php comments_template( '', true ); ?>
    				<?php endwhile; // end of the loop. ?>
    
    			<?php endif; // end have_posts() check ?>
    
    		</div> <!-- /.col.grid_12_of_12 -->
    
    	</div><!-- /#primary.site-content.row -->
    	<?php get_sidebar( 'front' ); ?>
    
    <?php get_footer(); ?>
    Theme Author Anthony Hortin

    @ahortin

    Apologies I haven’t been able to get to this sooner. I’ll try and get a chance to have a look at this later tonight

    Theme Author Anthony Hortin

    @ahortin

    I’ve just tried using the login details that you sent me via email, but I’m not getting the WordPress Login page. The only thing that I see is your “Coming soon” page. It doesn’t display the login form.

    RolandOfEld

    @rolandofeld

    my apologies, try again now

    thanks again, i really appreciate this

    RolandOfEld

    @rolandofeld

    also – i have updated the password to: Test123$

    🙂

    Theme Author Anthony Hortin

    @ahortin

    As I suspected, the issue isn’t due to Quark displaying extra Comment fields, it’s due to the Events Calendar Plugin adding in extra Comments section.

    You can tell this simply by looking at the code produced on the events page, using either Firebug (for Firefox) or Chrome Developer Tools (for Chrome). Instead of letting the theme handle the display of the Comments section, they’re calling the Comments template themselves and adding it in as part of their own content. They definitely shouldn’t be doing this!

    Anyway, the correct way to fix this is to create your own template. I’m presuming that the only reason you’ve chosen to use my Front Page Template is so that it will also display the widgets on the page. This Front Page Template should really be left alone, rather than modifying it for your events, as it’s a specific template for displaying on static homepages. The best way to do what you want is to select the Default Events Template for the Events Template option on the Display tab of the The Events Calendar Settings page. You then create your own copy of this template, which overrides the one that comes with the plugin.

    I’ve created this template for you and I will send it through to your email address. You simply need to create a tribe-events folder in your Child Theme folder and then add this new template. I’ve already changed that option I just mentioned, on your site so it should just automatically pick up this new template when you add it to your site.

    There are numerous benefits for doing it this way:
    – It leaves the font-page template for what it’s intended purpose is (ie. for displaying a static front-page)

    – It gives you the flexibility of changing the events page however you want

    – If you want to create separate widgets for displaying on your events pages (instead of using the same as the front page), you can. You just have to define the widgets and add them into the template.

    – It’s just proper way to do things.

    You can find out more about overriding their templates on their documentation pages – http://tri.be/support/documentation/events-calendar-themers-guide/

    RolandOfEld

    @rolandofeld

    Anthony you are an absolute gentleman!

    Not only have you fixed my problem but you opening my eyes to best practises for customizing things in wordpress which is priceless.

    thank you so much

    Theme Author Anthony Hortin

    @ahortin

    You’re welcome.

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘[Resolved] double comments with an event plugin’ is closed to new replies.