Support » Plugins » Related posts and Search in sidebar

  • Hello,

    I am trying to figure out how I can display related posts (by category/categories and/or tags) maybe top 5 but have a link to display all in a page. Also in need to be able to search within these related post only and not entire site.

    The initial related posts (top 5) will be in the side bar with a search box/form above it then a link to view all related post below the list of 5 related posts.

    The page that lists all the related posts will have a search box.

    I have found several code snippets but they are all for much earlier versions. I can post what I found if it would be helpful.

Viewing 1 replies (of 1 total)
  • I found this code which I put in functions.php

    function wp_search_form($form) {
    global $wp_query;
    $form = '<form method="get" id="searchform" action="' . get_option('home') . '/" >
    <input type="hidden" name="cat" value="'. $wp_query->get_queried_object_id() .'" />
    <input type="text" class="search_input" value="' . attribute_escape(apply_filters('the_search_query', get_search_query())) . '" name="s" id="s" />
    <input type="submit" alt="Search" class="greybutton float_right" value="Search" />
    return $form;

    And I put this in my page template: <?php wp_search_form(); ?>

    But the place where I am expecting to see the form show up is comping up blank.

    Am missing something or is the code I found no good?

Viewing 1 replies (of 1 total)
  • The topic ‘Related posts and Search in sidebar’ is closed to new replies.