HEX
Server: nginx/1.16.1
System: Linux VM-0-14-centos 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64
User: www (1000)
PHP: 8.3.31
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.sceybwg.com/wp-content/themes/Modular/template/loop/list-blog.php
<?php

/**
 * Template: 分类列表样式-blog
 * @Author: 大胡子
 * @Email:  dahuzi@xintheme.com
 * @Link:   www.xintheme.com
 * @Date:   2022-08-05 17:29:40
 * @Last Modified by:   dahuzi
 * @Last Modified time: 2023-09-02 10:20:05
 */

// 获取文章缩略图和 ALT 标签
$post_thumbnail_url = wpjam_get_post_thumbnail_url();
$img_alt = esc_attr(get_the_title($post));

if( is_category() ){
	$module_content['post_category'] = get_term_meta($cat, 'post_category', true);
	$module_content['post_date'] = get_term_meta($cat, 'post_date', true);
}

?>
<article class="post-item">
	<figure class="post-image">
		<a href="<?php the_permalink($post); ?>">
			<img loading="lazy" src="<?php echo $post_thumbnail_url; ?>" alt="<?php echo $img_alt; ?>">
		</a>
	</figure>
	<div class="post-text">
		<?php if (!empty($module_content['post_category']) || !empty($module_content['post_date'])): ?>
		<div class="post-meta">
			<?php 
			// 显示文章分类
			if (!empty($module_content['post_category'])) {
				$categories = get_the_category($post->ID);
				if (!empty($categories)) {
					$first_category = $categories[0];
					printf(
						'<a class="post-category" href="%s">%s</a>',
						esc_url(get_category_link($first_category->term_id)),
						esc_html($first_category->name)
					);
				}
			}

			// 显示发布日期
			if (!empty($module_content['post_date'])): ?>
			<div class="post-date">
				<span><?php echo esc_html(get_the_date('', $post)); ?></span>
			</div>
			<?php endif; ?>
		</div>
		<?php endif; ?>
		<a class="post-title" href="<?php the_permalink($post); ?>">
			<h3><?php echo get_the_title($post); ?></h3>
		</a>
		<div class="post-excerpt">
			<?php dahuzi_excerpt(200, '...'); ?>
		</div>
	</div>
</article>