How to remove Date and Comments from a page

edited August 2014 in HealthCentre
Hi,
I'd like to create pages without Dates and Comments ("leave a
reply"). Unfortunately, all the templates contain Dates and Comments.
How can I create a new page (e.g. "Default Template" style) WITHOUT Date and Comments?
If possible, please explain in a simple step-by-step way.

Thanks in advance,
BL

PS
I read this discussion, but honestly I didn't understand how to do it... And I think it doesn't solve the issue.

Comments

  • Hi

    Since these changes are to be done in the core theme files so you are suggested to make a child theme first.

    Once you create child theme, than I will suggest you the way to this, reason for suggesting child theme is because you will loose all your changes when you update the theme files of the previous version.

    Watch this link if you are not aware how to create it http://codex.wordpress.org/Child_Themes#How_to_Create_a_Child_Theme

    Let me know once you do that 

    Thanks
    Priyanshu
  • Hi again,

    I've just created a child theme.

    BL
  • HI 

    After creating a child theme follow the given below instructions :

    Firstly create a page.php file into the child theme directory

    then copy the code from page.txt (which is given below in the attachment ) file and

    paste into page.php file of your child theme directory.

    and save the changes.

    Thanks

    akhilesh

    page.txt
    2K
  • Hi again Akhilesh,
    thanks for your reply. It seems it works. However, there are still 2 objects that need to be deleted (circled in red in the attachment) :
    1) the author
    2) "no comments"
    How can I remove them from the pages?
    Thanks in advance,
    BL
    Schermata 2014-08-27 alle 16.55.11.png
    391 x 287 - 26K
  • Hi 
     ok 

    For this edit the page.php file of your child theme and Find These lines of code 

    <div class="hc_post_detail">
    <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>">     <i class="fa fa-user"></i><?php echo get_the_author(); ?></a>
              <a href="<?php the_permalink(); ?>"><i class="fa fa-comments"></i><?php        comments_number( 'no comments', 'one comments', '% comments' ); ?></a>
    </div>


    Then Remove these line of code .

    Thanks 

    akhilesh
  • Thank you very much, Akhilesh, I appreciate. It works.
    If I want to delete also the title of the page, I guess I need to remove these lines:
    <div class="hc_post_title_wrapper">									
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>

    Right?
    Regards,
    BL


  • Hi 

    Yes 
    But only one thing is missing , You also have to remove the closing  div  that is </div> 

    If you want to remove title, author and  no comment  of the page then Remove these line of code 

    <div class="hc_post_title_wrapper">
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <div class="hc_post_detail">
    <a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><i class="fa fa-user"></i><?php echo get_the_author(); ?></a>
    <a href="<?php the_permalink(); ?>"><i class="fa fa-comments"></i><?php comments_number( 'no comments', 'one comments', '% comments' ); ?></a>
    </div>
    </div>

    And find what one you missing .

    If your issue resolved  

    Can I close This Ticket ?
    Tell me



    Thanks 
    akhilesh




  • Yes, thanks again! I appreciate
This discussion has been closed.