WordPress.org

Ready to get started?Download WordPress

Forums

PHP Code Widget
[resolved] Conditional statements (3 posts)

  1. tatygrassini
    Member
    Posted 1 year ago #

    Is it possible to create something like this inside this widget...??

    <ul>
      <li <?php if ('body.home') { ?>class="selected"<?php } ?>>home<li>
      <li <?php if ('body.about') { ?>class="selected"<?php } ?>>about<li>
      ...
    </ul>

    http://wordpress.org/extend/plugins/php-code-widget/

  2. Samuel Wood (Otto)
    Tech Ninja
    Plugin Author

    Posted 1 year ago #

    What does if ('body.home') mean? I think you're confusing your Javascript with your PHP.

    Try if (is_home()) and if (is_page('about')) and similar.

    http://codex.wordpress.org/Conditional_Tags

  3. tatygrassini
    Member
    Posted 1 year ago #

    is_home and is_page they work great, thanks!

    is_product_category works as well if you happen to target a Jigoshop category.

    Hope this one helps somebody.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic