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 1 to 15 (35 total posts)

Comments on destination and directory pages

  • mike24

    said

    Are there any plans to have the standard WordPress comment system available for pages on the destinations plugin?

    I have tried several comment plugins but they never appear on the destinations plugin pages

    Thanks

  • andy

    said

    You would have to add support for comments to the CPTs and then also include a reference in the template files to call the comments form template.

    To add support for comments:

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

    To call the comments template in the theme template file:

    // If comments are open or we have at least one comment, load up the comment template
    if ( comments_open() || '0' != get_comments_number() ) {
      comments_template();
    }
  • mike24

    said

    Thanks Andy I appreciate your answer, I know this is beyond the themes support, but I take it the first bit of code goes in the pages file e.g single-travel-directory-php?

    I’m a bit of a novice at editing files so I’m not sure where to put the second piece of code, which temple file do you mean?

    Thanks

  • jeffw

    said

    Add the function that enables support for comments to the ‘functions.php’ file…

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

    Save and upload.

    Add the call to the comment template to the ‘single-destination.php’ template, and/or the ‘single-travel-directory.php’ template.

    In ‘single-destination.php’ look for this…

    <div class="intro">
      <p class="lead"><?php echo get_destination_intro(); ?></p>
      <div class="entry-content"><?php the_content(); ?></div>
    </div>

    And change it to this…

    <div class="intro">
      <p class="lead"><?php echo get_destination_intro(); ?></p>
      <div class="entry-content"><?php the_content(); ?></div>
      <?php
      // If comments are open or we have at least one comment, load up the comment template
      if ( comments_open() || '0' != get_comments_number() ) {
        comments_template();
      }
      ?>
    </div>

    In ‘single-travel-directory.php’ look for this…

    <div class="entry-content">
      <?php the_content(); ?>
    </div>

    And change it to this…

    <div class="entry-content">
      <?php the_content(); ?>
    </div>
    <?php
    // If comments are open or we have at least one comment, load up the comment template
    if ( comments_open() || '0' != get_comments_number() ) {
      comments_template();
    }
    ?>

    Save and upload.

    Keep in mind that if you modify core theme files then each time you update the theme you will need to make all of those modifications again to the updated theme files. If you are going to customise PHP templates it’s best to do that in a child theme. There are more details about how to create a child theme for GoExplore! here → http://para.llel.us/support/groups/goexplore/forum/topic/child-theme-5/#post-71402

  • mike24

    said

    Thanks Jeff, I really appreciate both yours and Andy’s support, great stuff!

  • andy

    said

    @mike24 No problem, that’s what we’re here for.

    Don’t forget to give us 5 stars on ThemeForest if you haven’t already! :)

  • gravnetic

    said

    Is there a preferred file in the theme to drop the comments function IE function.php or above the function-template.php? I didn’t see a comments call within the theme anywhere but it certainly support them (js, css, ETC).

  • jeffw

    said

    Add the function that enables support for comments to the ‘functions.php’ file.

  • flqa

    said

    Thanks all, works like a charm! :D

  • jlooman88

    said

    Does this need a comments section manually added, also?

    I added the code above and have nothing showing up.

  • jeffw

    said

    This post tells you what code to add and where to add it → http://para.llel.us/support/groups/goexplore/forum/topic/comments-on-destinations-directory/#post-72708

    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, it is not clear to me at what point inside the “function.php” file I have to add the following code. Andy gives no clues, so i can put everything at the end of the file?

    //to be added to function.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’);

    Then Andy says that you must “call the comments template in the theme template file”. Which is this file?
    Then you have to add the following code:

    // If comments are open or we have at least one comment, load up the comment template
    if ( comments_open() || ’0′ != get_comments_number() ) {
    comments_template();
    }

    Thanks

  • fulvio1982

    said

    Hi,

    I really don’t know why but the code you suggested to add it is not working to me…

    I have added this code at the end of function.php file

    http://prntscr.com/89juw5

    Then I modified ‘single-destination.php as follows:

    http://prntscr.com/89jwkk

    Then I modified ‘single-travel-directory.php’ as follows:

    http://prntscr.com/89jx59

    Everything has been saved and it is online. Wordpress Comments are on, in fact i have them in each article page:

    http://prntscr.com/89jxvc (altought it is in italian you should find familiar)

    What I have done wrong???

    Thanks for your always kind support.

    Bye

Viewing post 1 to 15 (35 total posts)