activate script when a category is selected??? (2 posts)

  1. forgetfear
    Posted 1 year ago #

    im trying to get code to work on pages with a praticular category selected im using javascript inbetween the php but i cant get the code to work for the life of me this is what i have tried so far


    $category = get_the_category();
    if (is_category('action')) { ?>

    script code

    <?php } ?>

  2. bemdesign
    Posted 1 year ago #

    Did you put the JavaScript code inside an HTML <script> tag? Although the best way to include JavaScript libraries and scripts is to use the wp_enqueue_script function.

Topic Closed

This topic has been closed to new replies.

About this Topic