Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Word Press separating  is_archive and is_search within loop.php

Posted on 2011-03-07
3
Medium Priority
?
627 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 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
OnPage is proud to be a Gold Sponsor at DevOps Days Boston 2017 taking place at the Cyclorama on September 18th  and 19th.  If you’re attending, please stop by booth 11 and get one of our cool give aways and enter to win one of the many prizes we’re…
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

618 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