Index.php没有在主页中显示我的新修改

时间:2017-02-17 16:47:45

标签: php html wordpress

我有这个index.php:

<?php
    //Getting Header
    get_header();
?>

    <div><h1>DOG</h1></div>

<!-- This do this function -->
    <!-- Content section -->
    <div class="content-section module blog-page">
        <div class="row">
            <?php
                $object_id = get_queried_object_id();

                //Getting Single Post Sidebar Position 
//yes
                $wc_sidebar_position_default = get_theme_mod("wc_blogsection_manage_sidebar");
                $wc_sidebar_position_special = get_post_meta($object_id, "wc_innerpage_sidebar_position", true);

                if($wc_sidebar_position_special == "left_sidebar"  || 
                   $wc_sidebar_position_special == "right_sidebar" || 
                   $wc_sidebar_position_special == "disable_sidebar") { 
                    $wc_sidebar_position = $wc_sidebar_position_special;
                } else { 
                    $wc_sidebar_position = $wc_sidebar_position_default;
                }

                switch($wc_sidebar_position) { 
                    case "left_sidebar":
                        //left sidebar
                        get_sidebar();
                        //Getting posts sides
                        get_template_part('template-parts/post-type/blog');
                    break;

                    case "right_sidebar":
                        //Getting posts sides
                        get_template_part('template-parts/post-type/blog');
                        //Right Sidebar
                        get_sidebar();
                    break;

                    case "disable_sidebar":
                        //Getting posts sides
                        get_template_part('template-parts/post-type/blog'); 
                    break;

                    default:
                        //Getting posts sides
                        get_template_part('template-parts/post-type/blog');
                        //Right Sidebar
                        get_sidebar();
                }//Ends Switch
            ?>
        </div><!-- Row Ends /-->
    </div>
    <!-- Content Section Ends /-->

<?php
    //Getting Footer
    get_footer();

我想阅读&#34; DOG&#34;在标题后我的页面中,但是当我重新加载页面时我没有阅读任何内容而且我不知道为什么。任何人都可以帮助我吗?

2 个答案:

答案 0 :(得分:0)

尝试移动div <div><h1>DOG</h1></div>内的<div class="content-section module blog-page">,看起来像这样:

<div class="content-section module blog-page">
<div><h1>DOG</h1></div>
...

现在可见吗?

答案 1 :(得分:0)

index.php可能无法提供您的主页。可能会显示其他几个可能的模板文件。

例如,如果您的主题有front-page.php,则该文件将是您要编辑的文件。或者,如果主页作为带有自定义页面模板的页面运行,您可能正在寻找类似template-home.php的内容。很难说没有看到网站/代码,就像之前的评论者所说的那样......