The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

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

  1. Koz
    Posted 11 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 11 years ago #

    Just use the conditional functions:


    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:


  3. Koz
    Posted 11 years ago #

    Thanks! that's exactly what I was looking for

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.