Responsive WordPress Theme – Caliber

A theme with simple controls and limitless potential. Work fast and build an amazing website!   Find out more »

UpThemes – Beautiful WordPress Themes

Create a site your church, gallery, newspaper, blog, recipes, band and more!   See the themes »

Need a little help?  Find answers quickly by searching the forum.
Group Admins
  • andy
  • jeffw
Group Mods
  • envatosupport

Create your travel agency, lodge, club, blog or destination website the quick and easy way. The GoExplore! travel WordPress theme can manage any travel website, from a personal travel blog to a world travel guide book.

GoExplore! (WordPress)

Public Group  |  active 1 year ago ago
Viewing post 16 to 30 (35 total posts)

Comments on destination and directory pages

  • jeffw

    said

    You’ll need to make sure that comments are enabled for the article. In the article editor click the Screen Options tab (top right) and under the “Show on screen” heading enable the Discussion option. A Discussion metabox will the appear and you will see where you can enable comments for that article.

  • fulvio1982

    said

    Hi Jeffw,

    Comments for articles are already opened. In fact for each article when i activate the discussion box i have this:

    http://prntscr.com/8ak11x

    What i was looking for is to add comments to destinations pages. When I add a new destination and I open the Screen Options i do not have the possibility to enable comments. Have a look here:

    http://prntscr.com/8ak23t

    to better explain see the difference between this page (that is an article page):

    http://www.viaggiatorineltempo.com/gocambio-insegnare-una-lingua-in-cambio-di-un-alloggio/

    and this other that is a destination:

    http://www.viaggiatorineltempo.com/destination/italia/il-bunker-di-soratte/

    Thanks

  • jeffw

    said

    The code we posted earlier in this topic adds comments functionality to destinations. If you don’t see the Discussion option in the Screen Options for a destination it means you made a mistake somewhere when modifying the code.

    You need to add this code to the foot of the theme’s ‘functions.php’ file…

    // Enable support for comments
    function add_destination_comment_support() {
      add_post_type_support( 'destination', 'comments' ); // destination
      add_post_type_support( 'travel-directory', 'comments' ); // directory
    }
    add_action('init', 'add_destination_comment_support');

    And this post describes how to modify the templates → http://para.llel.us/support/groups/goexplore/forum/topic/comments-on-destinations-directory/#post-72708

    The code works. I’ve done it myself so I know it works. Other customers have made the modifications and told us it works. So there is no point in telling us it doesn’t work, because it does work. We can’t make these modifications for you so if you are unable to make the modifications work yourself you will need to consider hiring a professional to help you.

  • fulvio1982

    said

    Hi Jeffw, I checked everything and i found my mistake in placing the code at the right position. Now everyhthing works and I would like to thanks for your patience and support.
    Bye

  • lelaiskandar

    said

    I didn’t get it to work.

    Because even when the comments are enabled, I see that they must be on for each travel directory item.

    I add this code in my function.php. Only then does the comments show up

    function my_comments_open( $open, $post_id ) {
    $post = get_post( $post_id );
    if ( ‘travel-directory’ == $post->post_type )
    $open = true;
    return $open;
    }

  • jeffw

    said

    The code posted in this topic works. I know it works because I tested it before I posted it, and I just tested it again.

    Now then. The way WordPress works, for the comments section to be displayed on a post you must enable the Allow people to post comments on new articles option in Settings > Discussion.

    As the option says, that enables comments for new articles. It does not enable comments for posts that already exist. That is the way Wordpress works. For existing posts you must edit each of them and enable the Allow comments option in the post’s Discussion metabox. Again that is the way WordPress works. This is not theme functionality, this is the way WordPress works.

    If you have a lot of existing posts, for all of which you want comments enabled, there are plugins available that can do that for you with a single click.

    NOTE: To include code in your posts such as shortcodes, HTML, CSS, JavaScript, PHP → please follow the instructions on the forum home page.

  • lelaiskandar

    said

    @jeffw

    Thanks for the clarification. I was trying to make it appear on all existing post. Didnt realize it is only for NEW posts.

  • davry21

    said

    When I pasted the “Enable support for comments” code in the child theme’s functions.php file, the code would show up at the top of every page in the site, even in the admin section.

  • jeffw

    said

    @davry21

    That means you made a mistake.

    Perhaps you forgot to add a <?php opening tag on the first line of your ‘functions.php’ file?

  • davry21

    said

    Here is my functions.php file from my child theme below. I also copied the ‘single-destination.php’ template, and the ‘single-travel-directory.php’ templates from the main theme to the same location in my child theme and updated them with the code provided above as well. Thanks for your help!

    // Enable support for comments
    function add_destination_comment_support() {
    add_post_type_support( ‘destination’, ‘comments’ ); // destination
    add_post_type_support( ‘travel-directory’, ‘comments’ ); // directory
    }
    add_action(‘init’, ‘add_destination_comment_support’);

  • davry21

    said

    Sorry forgot to wrap the code, here it is below:

    <?php
    function theme_enqueue_styles() {
      wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
    ?>
     
    // Enable support for comments
    function add_destination_comment_support() {
      add_post_type_support( 'destination', 'comments' ); // destination
      add_post_type_support( 'travel-directory', 'comments' ); // directory
    }
    add_action('init', 'add_destination_comment_support');
    
  • jeffw

    said

    The code posted in this topic is to add comments on destination and directory pages.

    That’s why the title of this topic is: Comments on destination and directory pages ;)

    If you also want destination information (guide) pages to support comments you’ll need to add support for that custom post type as well…

    function add_destination_comment_support() {
      add_post_type_support( 'destination', 'comments' ); // destination
      add_post_type_support( 'destination-page', 'comments' ); // destination information pages
      add_post_type_support( 'travel-directory', 'comments' ); // directory
    }
    add_action('init', 'add_destination_comment_support');

    You’ll need to modify the ‘single-destination-page.php’ template to include the comments_template() function, like you did for the other two templates.

    Related posts:
    http://para.llel.us/support/groups/goexplore/forum/topic/coments-on-info-pages-and-directory-pages/#post-88081

Viewing post 16 to 30 (35 total posts)