WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a theme I built from scratch I'm using the WP Photo Album Plus plugin. Per some books I've been using as guides, I need to include this code in the header in order to make comments work in a blog:

<?php if ( is_singular() ) wp_enqueue_script ( 'comment-reply'); wp_head() ; ?>

I've been including this line in the header of all my custom themes, whether the site includes a blog or not (my sites are all business sites, some with blogs included but none are primarily or only blogs). This site didn't have a blog so I removed that line of code. Doing that caused the photo albums to stop appearing on the pages. The shortcodes appeared as text instead. The albums were still in the admin and the plugin was still there, and everything else still worked.

Can anyone explain the connection?


share|improve this question
up vote 2 down vote accepted

This line has wrong syntax:

<?php if ( is_singular() ) wp_enqueue_script ( 'comment-reply'); wp_head() ; ?>

The call to wp_head() should not be on the same line as the conditional for the comment-reply script.

Change it to this:

// Conditional to determine if comment-reply form script should be included
if ( is_singular() ) wp_enqueue_script ( 'comment-reply'); 
// Fire the `wp_head` hook, which should happen always, on every pageload
share|improve this answer
Thanks - cleared that up! – PVA Jun 16 '11 at 18:27

http://codex.wordpress.org/Plugin_API/Action_Reference/wp_head wp_head() is the hook, where many plugins add their javascript, for instance, to include the script into the head area before the body tag.

share|improve this answer
Thanks Michael! Got it! – PVA Jun 16 '11 at 18:27

In Wordpress plugin,they are using lot of functions inherit from predefined functions.so if you are delete a line means that specific function will not work.so only error caused.Is this clear for you?

share|improve this answer
Thank you for replying - very helpful! – PVA Jun 16 '11 at 18:28
If you like my Answer means Give me Vote Up Please :) – Ramkumar Jun 17 '11 at 10:03

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.