2016-08-22 12:55
浏览 10


I got a wordpress page called "Galerie". I'd like to display some content on this page. So I createda php file called "content-galerie.php" and wrote some content in it. But the content is not displaying at all. It only displays the default page with the header, the title and the footer. How can i fix that? So my content gets displayed? For example a simple Text

<p>Lorem ipsum dolor sit amet consetetur sadipscing...</p>

图片转代码服务由CSDN问答提供 功能建议

我有一个名为“Galerie”的wordpress页面。 我想在此页面上显示一些内容。 所以我创建了一个名为“content-galerie.php”的php文件并在其中写了一些内容。 但是内容根本没有显示。 它只显示带有标题,标题和页脚的默认页面。 我该如何解决? 那么我的内容会显示出来吗? 例如一个简单的文本

 &lt; p&gt; Lorem ipsum dolor sit amet consetetur sadipscing ...&lt; / p&gt; 
  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dtid30526 2016-08-22 13:24

    You have to create Page template for gallery section.

     * Template Name: Gallery
    * This is the template that displays all pages by default.
    * Please note that this is the WordPress construct of pages and that
    * other "pages" on your WordPress site will use a different template.
    * @package WordPress
    * @subpackage Twenty_Sixteen
    * @since Twenty Sixteen 1.0
     // You can write your gallery content here
    <section class="section single-page">
    <div class="fixed_container">
        // Start the loop.
        while ( have_posts() ) : the_post();
            // Include the page content template.
            get_template_part( 'template-parts/content', 'page' );
            // If comments are open or we have at least one comment, load up the comment template.
            if ( comments_open() || get_comments_number() ) {
            // End of the loop.
    <?php get_footer(); ?>

    After that edit you gallery page from admin and assign this template to your gallery page.

    解决 无用
    打赏 举报
  • 查看更多回答(1条)

相关推荐 更多相似问题