WordPress.org

Forums

conditional statment based on URL (3 posts)

  1. perfectlover
    Member
    Posted 4 years ago #

    I want to use conditional tags to display content based on different url but do not know how to implement it, for example if page is

    http://examplesite/?Search=wordpress

    show
    XYZ

    if

    http://examplesite/?Search=plugin

    show
    ABC

    and so on

    Thanks in advance

    Steve

  2. Alok Tiwari
    Member
    Posted 4 years ago #

    Read this http://codex.wordpress.org/Creating_a_Search_Page
    Try with this code

    <?php
    if( trim( wp_specialchars($s,1) ) == 'wordpress' ) :?>
    [ Show XYZ ]
    <?php elseif( trim( wp_specialchars($s,1) ) == 'plugin' ) :?>
    [ Show ABC ]
    endif;
    ?>

  3. perfectlover
    Member
    Posted 4 years ago #

    Thanks,

    Actually search I used just an example, is it possible to define url? I am using a premium theme where categories are in custom post type and i want to use different content on different category.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.