HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: 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_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/dk/wp-content/themes/food/single.php
<?php
/**
 * The template for displaying all single posts
 *
 * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
 *
 * @package WordPress
 * @subpackage Twenty_Twenty_One
 * @since Twenty Twenty-One 1.0
 */

//echo 'single.php';

get_header('food');

//獲取預設info
//$home_info = new stdClass;
global $MallMallChannel_index_post_id;
$index_post_id = $MallMallChannel_index_post_id;// 81;
//$home_info = getHomeInfo($index_post_id);
//echo 'index_post_id:' . $index_post_id;

$result = wp_cache_get('home_info', 'food_group');
if (false === $result) {
    $home_info = getHomeInfo($index_post_id);
//    $result=$wpdb->get_results($query);
    wp_cache_set('home_info', $home_info, 'food_group', 60 * 60);
//    echo 'wp_cache_set';
} else {
//    echo 'wp_cache_get';
    $home_info = $result;
}

//獲取預設info
//$index_post = 81;
//$home_info = new stdClass;
//$home_info->cate1 = get_post_meta($index_post, "cate1", true);
//$home_info->part2_m_url = get_post_meta($index_post, "part2_m_url", true);
//$home_info->part2_pc_url = get_post_meta($index_post, "part2_pc_url", true);
//$home_info->part2_cate = get_post_meta($index_post, "part2_cate", true);
//$home_info->about_company_url = get_post_meta($index_post, "about_company_url", true);
//$home_info->about_content = get_post_meta($index_post, "about_content", true);
//$home_info->about_phone = get_post_meta($index_post, "about_phone", true);
//$home_info->about_call = get_post_meta($index_post, "about_call", true);
//$home_info->about_fax = get_post_meta($index_post, "about_fax", true);
//$home_info->about_addr = get_post_meta($index_post, "about_addr", true);
//$home_info->about_addr_en = get_post_meta($index_post, "about_addr_en", true);
//$home_info->payme_url = get_post_meta($index_post, "payme_url", true);

//$pid = intval($_REQUEST['p']);
//$query = new WP_Query('p=' . $pid);
////print_r($query);
//print_r($query->post);
//$postInfoObj = $query->post;


$menu_name = 'infos_menu';
$menuArr = ai_get_menu_items($menu_name);
//print_r($menuArr);

//多个分类别名共用一个模板
//if (in_category(array('themes', 'plugins', 'develop'))) {
//if (in_category('影視專區')) {
//    get_template_part('single-影視專區');
//
////不同分类名使用不同模板
//} elseif (in_category('infos')) {
//    get_template_part('single-infos');
//
////其他调用默认模板
//} else {
//    get_template_part('single');
//}


//如果有子分类使用下面方法:子分类文章使用父分类文章模板
//获取该文章父分类id
//$typeid = (get_the_category())[0]->category_parent;
////获取该文章父分类数据
//$category = get_category($typeid);
////该文章父分类别名
//$category = $category->slug;
//
////如果分类别名,或者父分类别名是product就选择single-product.php模板
//if (in_category(array('product') || $category == "product")) {
//    get_template_part('single-product');
////如果分类别名是news就选择single-news.php模板
//} elseif (in_category('news')) {
//    get_template_part('single-news');
//} else {
//    //其他文章调用默认模板
//    get_template_part('single-default');
//}


?>

<style>
    #main_bg{
        /*background-color:green;*/
        /*display: flex;*/
        /*flex-direction: column;*/
        height: 100%;
    }

    #app{
        /*background-color:darkred;*/
        height: 100%;
    }
</style>

<app id="app">
    <yq-header></yq-header>
    <!--    <yq-food-menu-infos></yq-food-menu-infos>-->

    <div id="main_bg">
        <main class=" w-100 py-[0.2rem] md:w-[768px] md:mx-auto xl:w-[1280px]"  style="min-height:60vh;height: 60vh" >
            <div class="mx-auto max-w-xl lg:mx-0 lg:flex lg:max-w-none">
                <div class="flex-auto w-auto lg:w-1/5 ">
                    <div class="float-left p-1 w-10 mr-2 " style="border: 1px solid #cccccc;">
                        <?php //wp_nav_menu(array('menu' => 'infos_menu', 'depth' => 2));
                        ?>

                        <?php
                        if (is_array($menuArr)) {
                            echo '<ul class="menu_main_ul">';

                            foreach ($menuArr as $menu) {
                                echo '<li>' . $menu->title . '</li>';

                                $subMenuArr = $menu->data;
                                if (is_array($subMenuArr)) {
                                    if (count($subMenuArr) > 0) {
                                        echo '<ul class="menu_sub_ul pl-[0.2rem]">';
                                        foreach ($subMenuArr as $sub) {
                                            echo '<li>' . '<a href="' . $sub->url . '">' . $sub->title . '</a></li>';
                                        }
                                        echo '</ul>';
                                    }
                                }
                            }
                            echo '</ul>';
                        }
                        ?>

                    </div>
                </div>

                <div class="w-auto lg:w-4/5 p-1 lg:mt-0 lg:flex-shrink-0 " style="border: 1px solid #cccccc;">

                    <div class="w-auto max-w-md flex-auto overflow-hidden text-[0.26rem] p-1">
                        <?php if (have_posts()) : ?>
                            <?php
                            // Start the loop.
                            while (have_posts()) : the_post();
                                ?>
                                <div class="text-[0.36rem] border-solid border-b-2 border-main-color pb-2"><?php the_title(); ?>
                                    single
                                </div>
                                <p class="mt-2 "><?php the_content(""); ?></p>

                            <?php

                                // End the loop.
                            endwhile;

                        else :
                            //                            get_template_part( 'content', 'none' );
                        endif;
                        ?>

                        <!--                        <div class="text-[0.36rem] border-solid border-b-2 border-main-color pb-2">-->
                        <?php //echo $postInfoObj->post_title;
                        ?><!--</div>-->
                        <!--                        <p class="mt-2 ">--><?php //echo $postInfoObj->post_content;
                        ?><!--</p>-->

                    </div>

                </div>
            </div>

        </main>
    </div>

    <yq-footer></yq-footer>
</app>


<script>
    const local_url = '<?php echo $local_url ?>'
    const home_info = JSON.parse('<?php echo json_encode($home_info) ?>')
    new Vue({
        el: "#app",
        components: {
            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header.vue?v=5') ?>'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer.vue?v=1') ?>'),
        },
        created() {
            // this.get_banner()
        },
        data: {},
        methods: {}
    })
</script>
<?php get_footer('food'); ?>