SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How could I bring my sidebar widgets to the WP "no results" screen?

    Just found a problem with my blog. Whenever someone searches for a product I don't have a blog entry for they get the "no results" page. I'd like to have some different text and a page of all my general sponsor links to direct them to for further searches. Is there any easy way to do this? TIA

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    17,290
    Mentioned
    198 Post(s)
    Tagged
    3 Thread(s)
    Does the theme you're using have a search.php file?
    For the sidebar widgets to show, it needs to have get_sidebar() in it. eg.

    My search.php file looks like
    PHP Code:
    <?php get_header() ?>

        <div id="container">
            <div id="content">

    <?php if ( have_posts() ) : ?>
    .....
    <?php while ( have_posts() ) : the_post() ?>
    .....
    <?php if ( $post->post_type == 'post' ) { ?>
    .....
    <?php ?>
    .....
    <?php endwhile; ?>
    .....
    <?php else : ?>
    .....
    <?php endif; ?>

            </div><!-- #content -->
        </div><!-- #container -->

    <?php get_sidebar() ?>
    <?php get_footer
    () ?>
    So you could hard code links and whatever in the area between the else and the endif

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    45
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Works great! Thank you!


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •