Solved

Word Press separating  is_archive and is_search within loop.php

Posted on 2011-03-07
3
618 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 125 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
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 Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

726 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