How to Format Search Results?

Discussion in 'Dzonia WordPress Theme' started by debuck, Dec 31, 2013.

  1. debuck

    debuck New Member

    Joined:
    May 17, 2012
    Messages:
    2
    Likes Received:
    0
    The posts show up fine, but the pages show up clunky. Here is the page - http://www.hartwoodanimalhospital.com/?s=behavior+dogs with an example search.

    I want the pages to show up as just a title and link - maybe a truncated first few words on the page/post.
    (It's ok if this is a universal formatting thing and the posts show up the same way as the pages, but it seems that pages and posts are treated differently formatting-wise.)

    I've dug through the code and found this call get_template_part( 'loop', 'search' ); but I've yet to find it's home to alter that code to format things pretty.

    Thanks for any help y'all can provide.
     
  2. Piyush

    Piyush Support Staff

    Joined:
    Dec 8, 2012
    Messages:
    4,745
    Likes Received:
    107
    Hello,

    For this issue you have to customize the code of search.php file and style.css file by yourself.
    Both file are present in the theme directory, you can edit them from there.
     
  3. debuck

    debuck New Member

    Joined:
    May 17, 2012
    Messages:
    2
    Likes Received:
    0
    The search.php file only has a single function call to get_template_part. There isn't much to edit there. After you replied, I did some brainstorming... I ran a code search algorithm on the entire site, and then searched for the file that function called up. I finally found where the ACTUAL formatting takes place - loop.php.
    The code here works famously for any blog posts, but doesn't look as clean for the pages that are returned with the search.
    Is there a variable on which I can test against to determine if it is a page vs. a blog entry?
    Here's my thinking:

    <? If [blog entry]=true {
    the code that is already there
    } else {
    new code formatting the pages returned }
    ?>

    Thanks!
     

Share This Page