HEX
Server: Apache
System: Linux top 5.8.11-1.el7.elrepo.x86_64 #1 SMP Tue Sep 22 18:18:35 EDT 2020 x86_64
User: www (1000)
PHP: 7.4.33
Disabled: passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
Upload Files
File: /www/wwwroot/www.018111.cn/wp-content/themes/jian/pages/zhuanti.php
<?php 
/**
 * Template name: 专题
 * Description:   A zhuanti page
 */

get_header();

$cat_args=array(
    'orderby' => 'name',
    'order' => 'ASC'
);
$categories=get_categories($cat_args);
$i = 0;
?>

<div class="container">
        <main class="site-main">

            <article id="post-<?php the_ID(); ?>" <?php post_class( 'post zhuanti' ); ?>>
              <div class="col-12">
              	<div class="row zhuanti">
              		<?php foreach($categories as $category) : ?>
              			<?php 
              				$i++;
              				if ($i>30) { break; } // 最多显示30个
							$args = array( 'cat' => $category->cat_ID, 'posts_per_page' => 1 );
							$posts = get_posts( $args );
							if ($posts) {
								foreach( $posts as $post ) {
									setup_postdata( $post );
									$bg_image = get_the_post_thumbnail_url();
									break;
								}
							}
						?>
              			<div class="col-12 col-sm-6 col-md-4 col-lg-3">
							<div class="zhuanti-tile">
								<div class="zhuanti-tile__wrap">
									<div class="background-img lazyload" data-bg="<?php echo esc_url( $bg_image ); ?>">
									</div>
						            <div class="zhuanti-tile__inner">
					                	<div class="zhuanti-tile__text inverse-text">
					                    	<a class="zhuanti-tile__name cat-theme-bg" href="<?php echo get_category_link( $category->term_id );?>" title="<?php echo $category->name;?>"><?php echo $category->name;?></a>
					                    	<div class="zhuanti-tile__description"><?php echo $category->count;?>篇文章</div>
					                    </div>
					                </div>
							    </div>
							</div>
						</div>
					<?php endforeach; ?>
				</div>
	
            </article>

        </main>
</div>

<?php get_footer(); ?>