Forums

Only Show on Certain Category (4 posts)

  1. eviljoker7075
    Member
    Posted 8 months ago #

    Hi there, I am planning on using custom fields to automatically search the iTunes store and insert a link to the particular song I am blogging about - however, I only want to dispaly this link under certain categories.

    I assume I will need to add the code in the template to display my custom fields and therefore I will need some sort of IF function to filter the categories. I think I'm ok getting the custom fields to display, but could use a little help getting the IF function to work - can any one help?

    Thanks

  2. t31os
    Member
    Posted 8 months ago #

    if(is_category('cat_name')) {
    Do your code..
    }

    Or ..

    if(!is_category('cat_name')) {
    If it is not your cat then do some code here..
    }

    Where cat_name is the name of your category...

    Is that what you're after?

  3. eviljoker7075
    Member
    Posted 8 months ago #

    Yep, seems to be - I'm at work right now so can't test it yet but I'll let you know.

    In the mean time am I to take it the "!" in the second one stands for 'isn't' essentially?

    Thank you :)

  4. t31os
    Member
    Posted 8 months ago #

    Yes that's right... :)

Reply

You must log in to post.

About this Topic