Using template tags in PHP if-statements

Phong Phan's Avatar

Phong Phan

17 Jul, 2014 05:30 PM

Is it possible to use template tags in PHP if statements? I've tried using the following without succes:

<?php if ( pageSlug() = "news" ):?>
<script type="text/javascript" src="/test1.js"></script>
<?php else: ?>
<script type="text/javascript" src="/test2.js"></script>
<?php endif ):?>

Any suggestions on what to do?

  1. Support Staff 1 Posted by Mikael on 20 Aug, 2014 11:48 PM

    Mikael's Avatar

    You need to use the double equals

    pageSlug() == "news"

  2. Phong Phan closed this discussion on 20 Oct, 2014 01:17 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac