Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13192
    SteveW
    Member

    Hi,

    I’ve added a function to my functions.php page and it would seem that it’s appearing on every page rather than only the home page.

    Is there a way I can only show it on the home page?

    I copied the code from another post which was the following:


    function catcheverest_child_sponsor() {
    echo 'example';
    } // catcheverest_child_sponsor
    add_action( 'catcheverest_main', 'catcheverest_child_sponsor', 1 );

    Thanks
    Steve

    #13227
    Sakin
    Keymaster

    @SteveW: When you edit the functions, don’t edit on the core theme files. First, build the child then and add the functions in your child theme functions.php file.
    you can add if ( is_home() ) { } condition. See this http://codex.wordpress.org/Function_Reference/is_home

    #13229
    SteveW
    Member

    Aha! Thank you very much! 🙂

    I hope that once I get this finished, I’ll have more time to explore exactly how powerful WordPress is!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Adding a function only for the home page’ is closed to new replies.