• Resolved doynet

    (@doynet)


    Hello, I use search in results about with search terms get_search_query(); for show random post. I installed for tags and categorys for include, When I activated add get_search_query(); was not working and it has not seen random posts.

    My post loop code:

    <?php
    global $post;
    $cat = get_search_query();
    $randomoyun = get_posts('numberposts=4&offset=0&orderby=rand&s='.$cat);
    foreach($randomoyun as $post) :
    setup_postdata($post);;
    ?>

    https://www.ads-software.com/extend/plugins/search-everything/

Viewing 1 replies (of 1 total)
  • Thread Starter doynet

    (@doynet)

    solved,

    i change post loop

    <?php
    								$cat = get_search_query();
    								query_posts('posts_per_page=4&offset=0&orderby=rand&s='.$cat);
    								if (have_posts()) :
    								while (have_posts()) :
    								the_post();
    							?>
Viewing 1 replies (of 1 total)
  • The topic ‘get_search_query(); not working for 'orderby=rand'’ is closed to new replies.