��权限没有,则隐藏 function forum_list_access_filter($forumlist, $gid, $allow = 'allowread') { global $grouplist; if (empty($forumlist)) return array(); if (1 == $gid) return $forumlist; $forumlist_filter = $forumlist; $group = $grouplist[$gid]; foreach ($forumlist_filter as $fid => $forum) { if (empty($forum['accesson']) && empty($group[$allow]) || !empty($forum['accesson']) && empty($forum['accesslist'][$gid][$allow])) { unset($forumlist_filter[$fid]); } unset($forumlist_filter[$fid]['accesslist']); } return $forumlist_filter; } function forum_filter_moduid($moduids) { $moduids = trim($moduids); if (empty($moduids)) return ''; $arr = explode(',', $moduids); $r = array(); foreach ($arr as $_uid) { $_uid = intval($_uid); $_user = user_read($_uid); if (empty($_user)) continue; if ($_user['gid'] > 4) continue; $r[] = $_uid; } return implode(',', $r); } function forum_safe_info($forum) { //unset($forum['moduids']); return $forum; } function forum_filter($forumlist) { foreach ($forumlist as &$val) { unset($val['brief'], $val['announcement'], $val['seo_title'], $val['seo_keywords'], $val['create_date_fmt'], $val['icon_url'], $val['modlist']); } return $forumlist; } function forum_format_url($forum) { global $conf; if (0 == $forum['category']) { // 列表URL $url = url('list-' . $forum['fid'], '', FALSE); } elseif (1 == $forum['category']) { // 频道 $url = url('category-' . $forum['fid'], '', FALSE); } elseif (2 == $forum['category']) { // 单页 $url = url('read-' . trim($forum['brief']), '', FALSE); } if ($conf['url_rewrite_on'] > 1 && $forum['well_alias']) { if (0 == $forum['category'] || 1 == $forum['category']) { $url = url($forum['well_alias'], '', FALSE); } elseif (2 == $forum['category']) { // 单页 $url = ($forum['threads'] && $forum['brief']) ? url($forum['well_alias'] . '-' . trim($forum['brief']), '', FALSE) : url($forum['well_alias'], '', FALSE); } } return $url; } function well_forum_alias() { $forumlist = forum_list_cache(); if (empty($forumlist)) return ''; $key = 'forum-alias'; static $cache = array(); if (isset($cache[$key])) return $cache[$key]; $cache[$key] = array(); foreach ($forumlist as $val) { if ($val['well_alias']) $cache[$key][$val['fid']] = $val['well_alias']; } return array_flip($cache[$key]); } function well_forum_alias_cache() { global $conf; $key = 'forum-alias-cache'; static $cache = array(); // 用静态变量只能在当前 request 生命周期缓存,跨进程需要再加一层缓存:redis/memcached/xcache/apc if (isset($cache[$key])) return $cache[$key]; if ('mysql' == $conf['cache']['type']) { $arr = well_forum_alias(); } else { $arr = cache_get($key); if (NULL === $arr) { $arr = well_forum_alias(); !empty($arr) AND cache_set($key, $arr); } } $cache[$key] = empty($arr) ? '' : $arr; return $cache[$key]; } ?>theme development - White screen of death on index.php page 3 and above?
最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

theme development - White screen of death on index.php page 3 and above?

programmeradmin3浏览0评论

I am experimenting with custom loops and following the tutorial of the illustrious Chip Bennett, and I actually got everything to work on index.php!

...

Up to, that is, page 3.

Everything works lovely when I go to page 2. On any higher page, it's white screen of death time.

To my eye, my code is practically identical to the one provided in the link, but for completeness:

    $hero_args = array(
    "posts_per_page" => "1",
    );

$hero_args['paged'] = get_query_var( 'paged' ) 
    ? get_query_var( 'paged' ) 
    : 1;

$heroPost = new WP_Query($hero_args);

<div class = "blog_content_wrap">
           <div class = "hero_blog">
               <?php    $temp_query = $wp_query;
               $wp_query   = NULL;
               $wp_query   = $heroPost;?>

               <?php if ($heroPost -> have_posts()): ?>
                Query contains something
              
                <?php while ($heroPost -> have_posts()):
                    $heroPost -> the_post();
                    the_title();?>
                   
                    
                <?php endwhile;
       
               ?>
                

               <?php else:?>
                No posts found, sucker
               <?php endif; 

               wp_reset_postdata();
               
            
               print_r ($hero_args['paged']);
               previous_posts_link( 'Older Posts' );
                next_posts_link( 'Newer Posts', $heroPost->max_num_pages );
               the_posts_pagination();
               $wp_query = NULL;
               $wp_query = $temp_query;
               ?>
    
           
            </div>

I have a sneaking suspicion it has to do with the max_num_pages? But I'm not sure at all. It's a PHP error, but I have no idea how to ask the question more precisely. If someone has a good idea of where to look, I'd appreciate it.

TLDR localhost/blogname/ = fine localhost/blogname/page/2 = fine localhost/blogname/page/3 = total destruction

Probably not necessary, but here's my full index.php:

<?php get_header(); ?>


<!--replace index.php with the list, home.php for the 'main' blog? -->
<?php



$hero_args = array(
    "posts_per_page" => "1",
  /*  'meta_key' => 'meta-checkbox',
    'meta_value' => 'yes' */


);

$hero_args['paged'] = get_query_var( 'paged' ) 
    ? get_query_var( 'paged' ) 
    : 1;


$post_args = array(
    "posts_per_page" => "3",
    "offset" => "1",
    
);


$pag_args1 = array(
    'format'  => '?page1=%#%',
    'current' => $page1,
    'total'   => $query1->max_num_pages,
    'add_args' => array( 'page2' => $page2 )
);


$heroPost = new WP_Query($hero_args);


// the loop
?>

<?php

/*
if ( $heroPost->have_posts() ) {
    while ( $heroPost->have_posts() ) {
        $heroPost->the_post();
        if ( (int) $heroPost->current_post === 0 ) {
          // loop content for hero post
        }
    } 
}*/

?>


<div class = "blog_content_wrap">
           <div class = "hero_blog">
               <?php    $temp_query = $wp_query;
               $wp_query   = NULL;
               $wp_query   = $heroPost;?>

               <?php if ($heroPost -> have_posts()): ?>
                Query contains something
              
                <?php while ($heroPost -> have_posts()):
                    $heroPost -> the_post();
                    the_title();?>
                   
                    
                <?php endwhile;
       
               ?>
                

               <?php else:?>
                No posts found, sucker
               <?php endif; 

               wp_reset_postdata();
               
            
               print_r ($hero_args['paged']);
               previous_posts_link( 'Older Posts' );
                next_posts_link( 'Newer Posts', $heroPost->max_num_pages );
               the_posts_pagination();
               $wp_query = NULL;
               $wp_query = $temp_query;
               ?>
    
           
            </div>

          
           <div class = "blog_grid">
      

                  
                   
                
                </div>
     
            
            
            
            <div class = "blog_div">
              <h1 class = "read_more_title">Blog Navigation</h1>
              <form>
              
                <input type="text"></input>
                <button>Search</button>
                <button>By Category</button>
                <button>By Date</button>
                <button>List</button>
         
      
         
            </div>

        
            


           </div>
          </div>

          <?php get_footer(); ?>

          <!--<div class = "blog_div">
              <h3>tit</h3>
              <h4>Olivia Bennett</h4>
              <p> ex</p>
                 <a href="#">Read more</a>
            </div>
            <div class = "blog_div">
              <h3>My Day at the Spinster's House</h3>
              <h4>Olivia Bennett</h4>
              <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Doloremque ad quae saepe dolorum. 
                Sequi quidem doloremque, explicabo, necessitatibus eum dicta perferendis
                 totam ex dolor at eos quae aliquid iusto fugiat?</p>
                 <a href="#">Read more</a>
            </div>
            <div class = "blog_div">
              <h3>My Day at the Spinster's House</h3>
              <h4>Olivia Bennett</h4>
              <p>Lorem ipsum dolor, sit amet consectetur adipisicing elit. Doloremque ad quae saepe dolorum. 
                Sequi quidem doloremque, explicabo, necessitatibus eum dicta perferendis
                 totam ex dolor at eos quae aliquid iusto fugiat?</p>
                 <a href="#">Read more</a>
            </div>-->
发布评论

评论列表(0)

  1. 暂无评论