Adding shortcode to header (4 posts)

  1. billrodgers2013
    Posted 1 year ago #

    Am using the Customizr theme and I love it.
    I'd like to add a shortcode to the header of every page. The shortcode shows 2 buttons - "Add Your Feed" and "Post Your Event". It's available with the Front End Submission for with All In One Event Calendar.

    I figure I could use

    <?php echo do_shortcode('[ai1ec_interactive_frontend]'); ?>

    but don't know how to place it.
    I am using a child theme and have inserted the code to add Search in the header. I'd like to put the shortcode just below that either centred or right aligned.

    Site is at http://thmcec.org.au

    Any help gratefully appreciated.

  2. nikeo
    Theme Author

    Posted 1 year ago #

    Hi @billrodgers2013, the hook you might want to use for that is an action hook named '__navbar', example :

    add_action('__navbar' , 'callback_function' , $priority = 40, $number_of_arguments = 1 );

    See some examples of implementations here.
    Bear in mind that you can set the actions order with the priority parameter when declaring a new action on a hook with add_action().
    Hope this helps!

  3. billrodgers2013
    Posted 1 year ago #

    Thanks for that!
    I ended up using the cod snippet example to add a widget area under the navbar, moved it to the right and then padded it a bit.
    then used Advanced Text widget and entered the php code there.
    Worked like a charm even though Advanced Text Widget would show the buttons if I did the same in a sidebar but they wouldn't work.

    Possibly a convoluted way to go about it but I now have a widget area up top. If only I could add more widgets and have them side-by-side and not stacked on top.

  4. nikeo
    Theme Author

    Posted 1 year ago #

    I am currently working on an important theme update to make it much easier to add widgets anywhere.
    Thanks for your feedback.

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic