1. PROMO Subscribe our All Access Pass @ 75% OFF & access all our 16+ premium Divi extensions: Divi Block Pro, Carousel Toolkit, etc.LEARN MORE
Dismiss Notice
NEW Divi.Help Pro Carousel AI Toolkit - Magically turn your Divi design into carousel, simply by using our online toolkit. No plugins needed. Now it works with Divi 5 as well!Try our carousel AI toolkit
BEST Divi Block - A revolutionary drag & drop tool to easily mix & match 960+ premade blocks (Light & Dark) to kick start your Divi site design. Special module designs are included as well. Also newly added AI generator & color. Now it works with Divi 5 as well!
Learn More About Divi BlockFree Version ~ 340+ Free Blocks

Overriding template.php files with child theme

Discussion in 'Basic Support Forum' started by fortes medien GmbH, May 17, 2023.

  1. fortes medien GmbH

    fortes medien GmbH New Member

    Hi,
    I copied "/Divi/includes/builder/comments_template.php" to "/Divi-Ulitmate/includes/builder/comments_template.php" and made some changes to it, but the changes don't reflect on site. If i edit the Divi-theme-files direclty it works fine.

    Do i have to add something to function.php in order to reloads or change the comments_template() function?
    How do i override template.php files like this, or "single.php" etc.?

    ___________________________________
    Specifically i want to achieve: if a post has "comments closed"-status, i want the comment section with "0 Comments" to be invisble. That's why i surrounded this Line in "comments_template.php" with an IF-Statement:

    <section id="comment-wrap">
    <?php if ( 'open' === $post->comment_status ) : ?>
    <<?php echo et_core_intentionally_unescaped( $et_comments_header_level_processed, 'fixed_string' ); ?> id="comments" class="page_title">TEST<?php comments_number( esc_html__( '0 Comments', 'et_builder' ), esc_html__( '1 Comment', 'et_builder' ), '% ' . esc_html__( 'Comments', 'et_builder' ) ); ?></<?php echo et_core_intentionally_unescaped( $et_comments_header_level_processed, 'fixed_string' ); ?>>
    <?php endif; ?>
    ...
    ...
    Please advise.
     
    1. PRO MEMBER PERKS Divi Block Pro - Premade team carousel design for your Divi site without using any plugins:View Demo
  2. Divi.Help Pro Support

    Divi.Help Pro Support Administrator
    Staff Member

    I believe that the template you need to override is comments.php at the root of your theme folder. Just copy the "/Divi/comments.php" to "/Divi-Ulitmate/comments.php" & make your changes.