Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1128749
    IanHep
    Participant

    Can I add my voice to the suggestion made in this closed topic? https://community.theme.co/forums/topic/comments-on-page/

    Not being able to add comments to a page, other than with the restrictive Layout page templates, just seems missing basic functionality. Like the original commentor here, I do not want to play with code, that is not why I bought X-Theme.

    Thanks

    #1128943
    Rahul
    Moderator

    Hey there,

    You will need to have this after The Loop in your theme’s page.php file:

    <?php comments_template(); ?>

    Hope that helps.

    #1139363
    IanHep
    Participant

    Thanks Rahul.

    As a non-techie, can I ask how I make this change? ie, where do I find this page.php file, how do I edit it, and what is “The Loop”?

    Thanks

    #1139383
    Christopher
    Moderator

    Hi there,

    Because this requires a template change, I’d advise that you setup a child theme. This allows you to make code changes that won’t be overwritten when an X update is released. After your child theme is setup, please review how we recommend making template changes in Customization Best Practices.

    You can copy the template from wp-content/themes/x/framework/views/STACK and put it in the same path inside child theme, then open the file and add <?php x_get_view( 'global', '_comments-template' ); ?> to template.

    Assume that you’re using ethos stack and you want to add comment to template-blank-1.php file, the code should be like following :

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/TEMPLATE-BLANK-1.PHP (Container | Header, Footer)
    // -----------------------------------------------------------------------------
    // A blank page for creating unique layouts.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="x-main full" role="main">
            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
              <div class="entry-wrap entry-content">
    
                <?php while ( have_posts() ) : the_post(); ?>
                  <?php the_content(); ?>
                  <?php x_link_pages(); ?>
                <?php endwhile; ?>
     <?php x_get_view( 'global', '_comments-template' ); ?>
              </div>
            </article>
            
          </div>
        </div>
      </div>
    
    <?php get_footer(); ?>

    Please check page templates names in the attachment .

    Hope it helps.

    #1139483
    IanHep
    Participant

    Thanks. I would appreciate a little more guidance before I start playing – as I said I am a newby to this. I have a child theme set up already.

    Your answer Christopher seems quite different from Rahul’s earlier. Can you please explain this for me?

    Also where do I edit the file(s)? Is this what I am changing in Dashboard>Appearance>Editor? I can only see one choice of theme “X” in the pull down list.

    Or do I have to go to my host and access each file and edit using Wordpad?

    Will this change add back the option on each page to “allow posts” with a tick box, or will it always add posts to every page? I want to be able to turn it on/off based on a page, like WP’s standard themes allow. And what happens if I decide I prefer a different template for my pages, will comments suddenly be turned off, and what will happen to existing comments if I change to a template that doesnt have the commenting change made?

    Thanks

    #1139974
    Rue Nel
    Moderator

    Hello There,

    Thanks for the updates! I am another staff checking on this thread! I will go back to your original post:

    
    Not being able to add comments to a page, other than with the restrictive Layout page templates, 
    just seems missing basic functionality. Like the original commentor here, I do not want to play 
    with code, that is not why I bought X-Theme.

    By default, this is already added with the default page template. You have the comments template right there. Now if in anyway, you have used a page template, please be advise that some of these page templates do not have comments templates for design purposes. So if ever you find that you do not see the comments templates that would be because you are using a special page template like the Blank – Container | Header, Footer or others.

    And if you ever want to add the comments template, since you have your child theme active and ready, please follow the following steps below: (I will just do a step by step of Christopher’s reply assuming you are using Ethos stack)
    1] Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.
    2] Insert the following code into that new file

    <?php
    
    // =============================================================================
    // VIEWS/ETHOS/TEMPLATE-BLANK-1.PHP (Container | Header, Footer)
    // -----------------------------------------------------------------------------
    // A blank page for creating unique layouts.
    // =============================================================================
    
    ?>
    
    <?php get_header(); ?>
    
      <div class="x-container max width main">
        <div class="offset cf">
          <div class="x-main full" role="main">
            <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
              <div class="entry-wrap entry-content">
    
                <?php while ( have_posts() ) : the_post(); ?>
                  <?php the_content(); ?>
                  <?php x_link_pages(); ?>
                <?php endwhile; ?>
     <?php x_get_view( 'global', '_comments-template' ); ?>
              </div>
            </article>
            
          </div>
        </div>
      </div>
    
    <?php get_footer(); ?>

    3] Save the file named as template-blank-1.php

    4] Upload this file to your server in the child theme’s folder
    wp-content/themes/x-child/framework/views/ethos/

    We would loved to know if this has work for you. Thank you.

  • <script> jQuery(function($){ $("#no-reply-1128749 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>