Forums

conditional rules for search page (1 post)

  1. calex3710
    Member
    Posted 6 months ago #

    Relative PHP noob here, trying to figure out how to add conditional code to display search results differently, depending on post category. Would really appreciate any help anyone can provide.

    I'd like a way to have my search page display search results from the post category 'event' as follows:

    <div class="searchresult">
    	<a href="http://myurl#<?php the_title(); ?>"><?php the_title(); ?></a>
    </div>

    Meanwhile I want it to display search results from the post category 'speaker' as follows:

    <div class="searchresult">
    	<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
    </div>

    Any ideas on how to write the conditional markup for this?

Reply

You must log in to post.

About this Topic