[Resolved] Child theme file does not overwrite the original

Home Forums Support Child theme file does not overwrite the original

  • This topic has 5 replies, 2 voices, and was last updated 3 months ago by David.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1342323
    Alfonso

    Good morning.
    I have changed the general.php file of the theme’s inc folder, but not to change the original theme I have done it in a child theme.
    In the child theme I have created the same folder inc and inside I have put the modified general.php file.
    The problem is that my website does not read the modified file of the child theme, but keeps reading the one of the parent theme.
    The child theme file does not overwrite the original.
    Which may be due?.
    Best regards.

    #1342359
    David
    Staff
    Customer Support

    Hi there,

    the general.php cannot simply be overwritten using a child theme.

    Most things in GP can be modified using hooks.
    What changes are you making to this file ?

    #1342363
    Alfonso

    Hi.
    In the general.php file I want to change the format of the widget-title class. Now is in <h2> and I want to set it in <p>. It’s to control the headers structure in my web.
    I don’t want that all the widget titles have <h2> header. I want them in <p>.
    Best regards.

    #1342369
    David
    Staff
    Customer Support

    Add this PHP snippet to your functions:

    add_filter( 'generate_start_widget_title', 'widget_title_start_tag' );
    function widget_title_start_tag()
    { 
        return '<p class="widget-title">';
    }
    
    add_filter( 'generate_end_widget_title', 'widget_title_end_tag' );
    function widget_title_end_tag()
    { 
        return '</p>';
    }
    #1342373
    Alfonso

    Thank you very much.

    #1342381
    David
    Staff
    Customer Support
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.