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/module-page/theme-post.php
<?php
/**
 * Template: 文章-1
 * @Author: 大胡子
 * @Email:  dahuzi@xintheme.com
 * @Link:   www.xintheme.com
 * @Date:   2023-08-01 07:27:28
 * @Last Modified by:   dahuzi
 * @Last Modified time: 2024-08-28 16:25:17
 */

if(!empty($module_content)){?>

<div class="section theme-post <?php echo $wow_style;?>">
    <div class="container">
        <?php
        if( !empty($module_setting['title_display']) ){?>
        <div class="post-box-heading">
            <div>
                <?php
                if( !empty($module_title) ){
                    echo '<h2>'.$module_title.'</h2>';
                }
                if( !empty($module_desc) ){
                    echo '<p>'.$module_desc.'</p>';
                }
                ?>
            </div>
            <?php
            if (!empty($module_content['more_url']) && 
                !empty($module_content['more_btn_text']) && 
                !empty($module_content['more_btn_url'])) {
                printf(
                    '<a class="btn-more" href="%s">%s<i class="ri-arrow-right-line"></i></a>',
                    esc_url($module_content['more_btn_url']),
                    esc_html($module_content['more_btn_text'])
                );
            }
            ?>
        </div>
        <?php }

        // 限制图片高度
        $post_thumb_pc_h = !empty($module_content['post_thumb_pc_h']) ? '--post_thumb_pc_h:' . intval($module_content['post_thumb_pc_h']) . 'px;' : '--post_thumb_pc_h:auto;';
        $post_thumb_mb_h = !empty($module_content['post_thumb_mb_h']) ? '--post_thumb_mb_h:' . intval($module_content['post_thumb_mb_h']) . 'px;' : '--post_thumb_mb_h:auto;';
        $post_thumb_h = ($post_thumb_pc_h || $post_thumb_mb_h) ? sprintf('style="%s%s"', $post_thumb_pc_h, $post_thumb_mb_h) : '';
        ?>

        <div class="post-box-list <?php echo esc_attr($module_content['list_style'] ?? ''); ?>" <?php echo $post_thumb_h; ?>>
            <?php
            // 指定文章处理
            if (!empty($module_content['post_id']) && $module_content['cat_post'] === 'post_id') {
                foreach ($module_content['post_id'] as $post_id) {
                    $post = get_post($post_id); // 获取单篇文章
                    if ($post) {
                        setup_postdata($post);
                        include TEMPLATEPATH.'/template/loop/list-blog.php';
                    }
                }
                wp_reset_postdata();
            }

            // 对应分类文章处理
            if (!empty($module_content['cat_id']) && $module_content['cat_post'] === 'cat_id') {
                $args = [
                    'posts_per_page'        => $module_content['post_per_page'] ?? 6,
                    'ignore_sticky_posts'   => true,
                    'cat'                   => $module_content['cat_id'],
                ];
                $cat_posts_query = new WP_Query($args);

                if ($cat_posts_query->have_posts()) {
                    while ($cat_posts_query->have_posts()) {
                        $cat_posts_query->the_post();
                        include TEMPLATEPATH.'/template/loop/list-blog.php';
                    }
                    wp_reset_postdata();
                } else {
                    echo '<p style="width:100%;text-align:center;">' . __('暂无相关内容', 'modular_theme') . '</p>';
                }
            }
            ?>
        </div>
    </div>
</div>
<?php }?>

<?php
//echo wpjam_print_r( $module_setting );
//echo wpjam_print_r( $module_content );
//echo wpjam_print_r( $module_style );