This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

How to add code within the head tag

  • Creator
    Topic
  • #6000

    How do I add a code within the head tags of the html, specifically the main page?

    Thanks again for all your help,

    Florin

Viewing 3 replies - 1 through 3 (of 3 total)
  • Author
    Replies
  • #6018
    Jason Bobich
    Keymaster

    Hello Florin,

    If you’re not trying to do anything completely custom and you’re just wanting to edit common things like SEO meta data or whatever, you should look at just using some sort of SEO plugin like Yoast SEO:

    http://wordpress.org/extend/plugins/wordpress-seo/

    Otherwise, you’d just output your content from some function and hook it to “wp_head” from your Child theme’s functions.php file.

    http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head

    http://dev.themeblvd.com/tutorial/actions/

    #6024

    All I’m trying to do is add a 3rd party vacation rental search form on my website that requires to add a small code within the tags along with the code that would go between the tags. Also I don’t have the theme set up as a child theme either. Any suggestions? Thanks again.

    #6036
    Jason Bobich
    Keymaster

    Install the sample child theme included with the theme. Hook your content to wp_head from your Child theme’s functions.php. I’m honestly not really sure what other kind of answer you’re looking for on adding custom code to your <head>.

    function my_stuff(){
    	if( is_home() ) :
    	?>
    	your stuff for the <head> ...
    	<?php
    	endif;
    }
    add_action( 'wp_head', 'my_stuff' );
Viewing 3 replies - 1 through 3 (of 3 total)
  • The forum ‘Alyeska Responsive WordPress Theme’ is closed to new topics and replies.