WordPress.org

Forums

Detecting if result is individual or multiple entries (3 posts)

  1. Koz
    Member
    Posted 10 years ago #

    Hey guys,

    I'm loving the new theme functionality in WordPress 1.5, I'm trying to port my old 'hacked' setup to the new theme mechanism. The last bit that is giving me grief is detecting whenther this is an individual item (i.e clicked on a perma link) or an index.

    If the user is viewing a permalink I want to show one kind of adsense ads (underneath the comments) and if it's an index with multiple entries I want to show the ad somewhere else (left hand panel).

    I figure that this must be possible with the themes as they seem to know whether to show the comment form or not.

  2. Kafkaesqui

    Posted 10 years ago #

    Just use the conditional functions:

    is_home()
    is_single()

    These are new to 1.5, and allow you to set up simple if/else statements to detect where one is on your site. So say you want to display something only on the home page; you could use this method:

    <?php if(is_home()) : ?>

    ~Content to only display on the home page goes here.~

    <?php endif; ?>

    Here's a list of the conditional statements in 1.5:

    http://boren.nu/archives/2004/10/16/templates-and-the-is-functions/

  3. Koz
    Member
    Posted 10 years ago #

    Thanks! that's exactly what I was looking for

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.