?
Solved

Word Press separating  is_archive and is_search within loop.php

Posted on 2011-03-07
3
Medium Priority
?
629 Views
Last Modified: 2012-05-11
Can anyone help me with modifying the loop.php file in the twentyten theme for wordpress.

I would like to display search results totally different to my archive results.

can anyone advise what part of code am i changing? i take it its within the loop.php where it says

<?php if ( is_archive() || is_search() ) : // Display excerpts for archives and search. ?>
                  <div class="entry-summary">
                        <?php the_excerpt(); ?>
                  </div><!-- .entry-summary -->
            <?php else : ?>
                  <div class="entry-content">
                        <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
                  </div><!-- .entry-content -->
            <?php endif; ?>

0
Comment
Question by:Andy6350
  • 2
3 Comments
 
LVL 31

Expert Comment

by:gwkg
ID: 35060091
You say you want to display archive and search differently, but your code is saying to only display the excerpts for archives and search.

Even the comment says // Display excerpts for archives and search

Everything that isn't an archive or search shows the_content
0
 

Author Comment

by:Andy6350
ID: 35061562
Thank you for responding

I changed the above code to the code attached so that i could display my posts results different to my search results.

 the following link shows what my posts display like

http://www.bluebean.org.uk/current/category/176000-250000/

the link below shows the issues i have with the search, not all the content seems to appear in the content div, only the first post.

http://www.bluebean.org.uk/current/?x=52&y=16&s=house


If this is not clear then let me know

Many Thanks,
loop.php
0
 
LVL 31

Accepted Solution

by:
gwkg earned 500 total points
ID: 35089912
Instead of using this first

if ( is_archive()) :

use is_search first...

if(is_search()) :

// show excerpts

else :

// show posts

endif;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will shed light on the latest trends when it comes to your resume building needs. For far too long, the traditional CV format has monopolized the recruitment market.
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The purpose of this video is to demonstrate how to Test the speed of a WordPress Website. Site Speed is an important metric of a site’s health. Slow site speed can result in viewers leaving your site quickly and not seeing your content. This…
The purpose of this video is to demonstrate how to integrate Mailchimp with Facebook. This will be demonstrated using a Windows 8 PC. Mailchimp and Facebook will be used. Log into your Mailchimp account. : Click on your name. Go to Account Setti…
Suggested Courses
Course of the Month16 days, 17 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question