• kitka

    (@kitka)


    Hello,
    I was wondering how to add a comments area to the single event template single-el_events.php

    I have inserted this code but it does not show the comments area – any advice is appreciated.

    <?php
    if (is_user_logged_in()){
    comments_template();
    }
    else {
    echo “<small>Logged-in members can view comments</small>”;
    };
    ?>

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

Viewing 5 replies - 1 through 5 (of 5 total)
  • hatesspam

    (@hatesspam)

    I don’t know too much about this, but it seems the el_events post type is created without support for comments.

    To enable this support, add the following to your functions.php:

    add_action( 'init', 'rollerderbye_init' );
    
    function rollerderbye_init() {
      add_post_type_support( 'el_events', 'comments' );
      // remove_post_type_support( 'el_events', 'comments' );
    }

    I haven’t fully tested what this does (and haven’t found an article on www.ads-software.com that explains what it does), but this appears to at least have the following effects:

    – On new events, adds comments.
    – On existing events, lets you enable comments in the event’s Edit screen.

    (Note that comments should first be enabled in the site’s settings.)

    To remove the comments option, comment out the line that starts with ‘add’ and uncomment the line that starts with ‘remove’. It seems this won’t remove comments from existing events.

    You should probably play around with this a little on your development server before you put this into production.

    Thread Starter kitka

    (@kitka)

    Hey, that works. Thanks!

    Now I have only one other thing to work out. On my theme, when I click on a single event in the sidebar widget, it displays that event in the index.php page, not the single-el_events.php page

    Any idea on how I make it show in the right page?

    hatesspam

    (@hatesspam)

    The sidebar widget has ?event_id1=NNN type links, does it not? Works basically like the shortcode.

    Thread Starter kitka

    (@kitka)

    Yes. The widget asks for URL to the linked Event List page (which I have put in) and the Shortcode ID on linked page (which I have added as ‘2’). If I make that Shortcode ID ‘1’ then clicking on one event shows the whole lot of events. If I make that Shortcode ID ‘2’ then clicking on one event shows just that single event but in the index.php template. I want it to show just the single event but in the single-el_events.php template.

    Not sure how to do that.

    hatesspam

    (@hatesspam)

    BTW, ‘rollerderbye’ is the name of my own theme, you should probably change the occurrences of that phrase to that of your own theme (for neatness’ sake).

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Can I add comments to single-el_events.php?’ is closed to new replies.