Forums

[resolved] is_category not working (3 posts)

  1. dyakub
    Member
    Posted 2 years ago #

    I'm using wordpress version 2.86 and I'm having problems with the "is_category" in php. What I'm trying to do is redirect a user to a page if the user clicks on a category. This is the code I tried:

    <?php
     if (is_category('twitter')) {
     get_page($twitter-updates);
     }
    ?>

    If this code is correct, then it says if the category "twitter" is displayed, then get/display the page "twitter updates". When a user clicks on the category "twitter", instead of displaying the posts in the category the browser will display the page "twitter updates".

  2. Dene
    Member
    Posted 2 years ago #

    Hi -

    I'm a big fan of the Redirection plugin. You might try the plugin to do what you are trying to do in your php.

    After installing the plugin, go to Tools; Redirection.

    Then, add a Redirection with source url =

    http://yoursitename.com/category/twitter/

    and target url =

    http://yoursitename.com/twitter updates/

    The exact value will vary depending on your permalinks and actual page name.

    Hope that works for you.

  3. dyakub
    Member
    Posted 2 years ago #

    Thank you so much; So much easier than messing with the php

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.