• This is all that is in my Child Theme PHP file:

    <?php
    function insertHeadImage($content) {
            if(!is_feed() && !is_home()) {
                    $content.= "<div class='Head'>";
                    $content.= "<img src='https:// martcol.co.uk/abba/wp-content/uploads/sites/7/2014/02/cropped-abba-skip-hire-logo.png' /a>";
                    $content.= "</div><!-- div.head-->";
            }
            return $content;
    }
    add_filter ('the_content', 'insertHeadImage');
    
    ?>

    I added this to the header.php file where I think I want the content to be but it makes no difference:

    <?php insertHeadImage($content); ?>

    The added HTML currently appears a the bottom of my content so I have two questions:

    1)How does WordPress know to put it where it puts it
    2) What do I do to generate some content and add it where I want i to go.

    Thanks

    Martin

Viewing 1 replies (of 1 total)
  • From the codex you will see that the ‘the_content’ hook applies to the content of a post, not the whole page.

    One way of getting the results you want may be to use the wp_head hook.

    I’m sure you have read this, but if you haven’t I would recommend you do so now.

    As you can see from that page there are a number of ways in which you can modify the parent theme.

    If you are planning on developing a child theme then I would recommend searching google for tutorials on developing WordPress child themes as there are a lot out there.

    Hope this helps.

Viewing 1 replies (of 1 total)
  • The topic ‘Help with PHP Hook’ is closed to new replies.