0

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 } ?>
1
  • Yes. Your error log. Commented Feb 13, 2012 at 6:44

4 Answers 4

2

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 } ?>
Sign up to request clarification or add additional context in comments.

2 Comments

Poonam's answer seemed to work without using echo. Is using echo just a better way of writing it?
No, they are actually different. echo puts the result in html. Leaving it out puts nothing in the html. But I guess bloginfo() has the "echo" in it itself.
0

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')

2 Comments

No need for an echo there for bloginfo. If you use get_bloginfo then you need to use the echo. Thanks
thanks vasanthan.R.P ,I just confused for a while between bloginfo and get_bloginfo , now its clear
0

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

Comments

0
echo bloginfo('template_url'); 

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.