[Resolved] Head code for "Posts page"?
I’m trying to put some code in the <head> portion of a website, and have been using the “Enhanced Header / Footer Injections” plugin to do it easily. It had been working well until I created a blog page rather than a static page. I can edit the header.php file found in the theme folder, but any edits I do there only show up on static pages. It seems that blog pages use a totally different file (or maybe it’s just a condition that is set somewhere?) to show the header. What can I do about this?
What sort of code are you trying to insert?
Yeah, I’m talking about the <head> section. I’ve realized that the code actually does work on the blog page and static pages. The thing that doesn’t work is using the is_page_template function as a condition to identify the blog page (I only want to add the code to the blog head section). Do you know of a better function I can use?
I will try when I’m back in front of my computer, but I’m not sure that’ll work because the front page on my site is static. The blog part is linked to from that page.
There is a tag for that too,
It worked! I had tried dozens of ideas and skipped the one that was under my nose the whole time. Thank you so much!
I’ve been thinking of adding options to add code to the ‘special’ pages.
Of them would include
- 404 Page
- Home Page
- Front Page
- Archives Pages
- Custom Post Type / Taxonomy Pages
Sounds great! BTW, I love the plugin. Very simple and effective.
Enhanced Header / Footer Injections is great plug in, but I need a tiny modification. I will try to explain. The code is now showin above the header.php, and I need under it.
How to doo that?
The plugin isn’t designed to work the way you suggest. The code is injected into the
<head>part of the site (via the wp_head() action hook) or right before the end of the page, which would be just before the
</body>tag (via the wp_footer() action hook).
Sorry if there was any confusion as to what this plugin is aimed to accomplish!
Thanks for reply. Can you suggest me some plug in for my needs?
I am not aware of any plugins that will add code into your theme. However this would be an interesting feature to have in a plugin. Maybe the plugin would scan all the action hooks of the active theme and allow for code injection that way. Come to think of it, I think the Thesis theme has a plugin for it that allows for code injection.
Anyway… If you’re looking to add code into the theme you have a couple of options.
- You can insert code directly into the theme by editing the active theme’s files
- Hopefully the theme will be well coded and will have and support several action hooks. If this is the case, all you have to do is find and reference the correct action hook and attach a function to it that will insert your code. Check out this function and its surrounding resources for an idea of how to do this. http://codex.wordpress.org/Function_Reference/add_action
- The topic ‘[Resolved] Head code for "Posts page"?’ is closed to new replies.