Okay
  Public Ticket #370140
Override single-portfolio.php in child theme
Closed

Comments

  • pedro started the conversation

    Hi,

    I 'm trying to make some changes on single- portfolio.php. I copied the file in my child theme folder and make some changes, but it doesn't work . This is the single-portfolio file of the parent theme is included . Is there something to declare in the functions.php of the child theme to load the correct file ?

  •  8,848
    Tahir replied

    Hey Pedro!

    See url : http://www.organizedthemes.com/advanced-child-theme-usage/ . You will likely have to include the child theme single-portfolio manually.

    Thanks


    ThemeNectar Support Team 

  • pedro replied

    Thank you Tahir.
    I tried to follow these tips, but it goes wrong.
    In my child theme: functions.php i add this:

    if ( ! function_exists( 'salient_files' ) ) {
        function salient_files() {
        // include required files
            include(get_stylesheet_directory()."/single-portfolio.php");
        } 
    }
    add_action( 'after_setup_theme', 'salient_files' );
    
    

    It doesn't work.
    The single-portfolio.php of the parent theme is included on every page.
    I must not have understood or I have forgotten something.
    Perhaps i have to call the function of the parent theme who loads the single-portfolio file instead of 'salient_files' who refers to nothing.
    But i can't find it.

  • pedro replied

    Sorry.
    It works without added something in functions.php.
    I made a mistake by editing the single-portfolio.php file in my child theme.
    I fixed it and it works now.
    Sorry I should have checked what I did before to ask this question.