How do I add to header ONLY on specific pages? + Adding Jquery (1 post)

  1. OM2
    Posted 5 years ago #

    I'm trying to write a plugin that needs to add to the header
    I don't want to add the header to every single page of the website - only on specific pages I choose
    I thought I could maybe do this using shortcodes - but it doesn't seem to be working

    This is what I have:

    function myFunc()
    function myHeaderFunc(){
    	echo <<<myStringEcho
    My header code goes here
    add_shortcode( 'myheader', 'myFunc' );

    So, the intention is that if the user puts [myheader] on a page, the myHeaderFunc code gets called and added to the header with the add_action code

    NOTE: I've used <<< - does this cause a problem?

    I thought it was a neat solution!

    But not working

    Where am I going wrong?
    Can shortcodes be used in the way I have tried and do what I want?



Topic Closed

This topic has been closed to new replies.

About this Topic