[Resolved] filter in functions.php child theme not working

Home Forums Support [Resolved] filter in functions.php child theme not working

Home Forums Support filter in functions.php child theme not working

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #339788
    Wilfred

    Really strange thing. When I add this piece of code in the functions.php of my child theme:

    add_filter( ‘generate_show_title’, ‘your_function_name’ );
    function your_function_name()
    {
    return false;
    }

    it’s not working. When I add this to my functions.php of generatepress (not the child theme of generatepress) it works. Is this normal? And yes πŸ™‚ I’m using the Child theme.

    #339805
    Tom
    Lead Developer
    Lead Developer

    You may need to hook it into an action like after_setup_theme which makes sure the filter has initiated.

    add_action( 'after_setup_theme', 'tu_remove_title' );
    function tu_remove_title() {
        add_filter( 'generate_show_title', '__return_false' );
    }
    #339808
    Wilfred

    Yes, that worked. And I understand what you did… thanks!

    #339809
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

    #1136573
    David

    The amount of snippets that I’ve added and never worked… now I know why. πŸ™‚

    Thanks, Tom.

    #1137028
    Tom
    Lead Developer
    Lead Developer

    Sometimes it can be a pain! Glad I could help πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.