John
John

Reputation: 627

Is there something wrong with this php if statement?

Here is what I have included in the head of my WordPress site. However, it is producing a blank page. Is there something I might have overlooked?

<?php if (is_page('talent')) || (is_page('work')) { ?>
<script src="<?php bloginfo('template_url'); ?>/js/jquery.fancybox-1.3.4.pack.js"></script>
<?php } ?>

Upvotes: 0

Views: 116

Answers (4)

Chaitanya Mutyala
Chaitanya Mutyala

Reputation: 196

echo bloginfo('template_url'); 

Upvotes: 0

NILAY PATEL
NILAY PATEL

Reputation: 78

You can chek below code.

->if statement replace with this one:

if (is_page('talent') || (is_page('work')) {

-> src attribute in script tag replace with below one:

echo get_bloginfo('template_url'); ?>/js/jquery.fancybox-1.3.4.pack.js

Upvotes: 0

Poonam
Poonam

Reputation: 4631

Breakets are mismatching

if (is_page('talent') || (is_page('work'))){

try replacing your if statement with the given

and echo is missing before bloginfo('template_url')

Upvotes: 0

Ben Lee
Ben Lee

Reputation: 53349

The answers of both @chaitanyaMutyala and @Poonam are both right, but neither is complete. You need both fixes. The parenthesis don't match in your if statement and you need to echo the url:

<?php if (is_page('talent') || (is_page('work')) { ?>
    <script src="<?php echo bloginfo('template_url'); ?>/js/jquery.fancybox-1.3.4.pack.js"></script>
<?php } ?>

Upvotes: 2

Related Questions