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?

Thanks!

3 Answers
3

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:

<?php 
// 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
wp_head(); 
?>

Leave a Reply

Your email address will not be published. Required fields are marked *