Display based on Category (5 posts)

  1. Krissy
    Posted 8 years ago #

    With the rise of Paid-to-Blog sites on the 'net, it's been easy to make money while blogging. The problem with most paid-to-blog sites is they don't permit ads from other sites in the entries. Paysite1 (for example) is the only Category/Tag I need these ads to show up in every time it's chosen on a new post.

    Say I have a category named Sponsors, that's broken down into three sub-categories, Paysite1, Paysite2, Paysite3

    Is there a way to format my index.php/single.php template files so that an image will load only if Paysite1 is linked as the category? This way it isn't a static image in the closing of all the weblog entries, it's only displayed as a direct link with the Paysite1 category?

    I hope I've said this clearly, my apologies if I haven't. From a programmers stand point

    If ($category=20)
    {display: http://www.site.com/advertise.gif}
    {display: http://www.site.com/blankimage.gif}
    End If

    Is there a hack for this? I went through the codex and wp-plugins.net but nothing really stood out.

    I'm using WP 2.1.3.

  2. rudolf45
    Posted 8 years ago #

    If I understand well what you'd like to do - I'd suggest to take a look at the Category Templates and this plugin: http://guff.szub.net/2005/07/21/post-templates-by-category/

  3. Also look into the is_category() and in_category() functions:


  4. Krissy
    Posted 8 years ago #

    Thank you very much for your replies but I still have a small issue. These templates only work for individual entries. I'd need it to setup on the index.php file as well.

    Any advise?

  5. Those conditional tags will work anywhere. Look again.

Topic Closed

This topic has been closed to new replies.

About this Topic