Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Network wordpress site with custom query issue.

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #43044
    andshespeaks
    Participant

    I have a custom query for my network site home page that pulls in all the recent post of the all the blogs. WordPress realizes that I don’t have post for that specific blog so after the first page all my additional pages return 404 but the query is still displayed. The root cause is the wp_class.php function handle_404 (). Does anyone have a work around that might assist with my situation. Or how do I overwrite the wp_query to use my query temporary for that page.

    function get_eh_all_grp_recent_post($blog_list){
    global $wpdb;
    $other_sqlstr = ”;
    $limitstr = ”;
    $uni = ”;

    foreach ($blog_list AS $blog) {
    if ($other_sqlstr != ”)
    $uni = ‘ union all ‘;;
    if($blog == 1) {
    $other_sqlstr .= $uni . ” (SELECT “.$blog.” as blog_id, id, post_date from wp_posts where wp_posts.post_status = ‘publish’ and wp_posts.post_type = ‘post’ and wp_posts.post_title <> ‘”.__(‘Hello world!’).”‘)”;
    }
    else {
    $other_sqlstr .= $uni . ” (SELECT “.$blog.” as blog_id, id, post_date from wp_”.$blog.”_posts where wp_”.$blog.”_posts.post_status = ‘publish’ and wp_”.$blog.”_posts.post_type = ‘post’ and wp_”.$blog.”_posts.post_title <> ‘”.__(‘Hello world!’).”‘ )”;
    }
    }

    //$limit = ‘ LIMIT ‘.$start_page.’, 10′;
    $other_sqlstr .= ” ORDER BY post_date desc “;// . $limit;

    $grp_recent_posts = $wpdb->get_results($other_sqlstr, ARRAY_A);
    //echo $wpdb->print_error();

    return $grp_recent_posts;
    }

    #126924
    andshespeaks
    Participant

    I am now using wp_multisite_query in hopes to solve the issue but I am still getting a 404 error on page 2.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Other’ is closed to new topics and replies.