Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php Wordpress-如何使自定义页面模板动态_Php_Wordpress_Custom Wordpress Pages - Fatal编程技术网

Php Wordpress-如何使自定义页面模板动态

Php Wordpress-如何使自定义页面模板动态,php,wordpress,custom-wordpress-pages,Php,Wordpress,Custom Wordpress Pages,我正在使用Wordpress创建一个包含许多自定义页面模板的网站。我使用HTML5 blank作为父主题。我需要将页面内容从文本文件移到Wordpress页面,以便可以在CMS中进行编辑,但我不确定如何为代码创建正确的循环/模板标记 下面是一个页面示例- 模板满足team.php <?php /* Template Name: Meet the team */ ?> <?php get_header(); ?> <section id="team">

我正在使用Wordpress创建一个包含许多自定义页面模板的网站。我使用HTML5 blank作为父主题。我需要将页面内容从文本文件移到Wordpress页面,以便可以在CMS中进行编辑,但我不确定如何为代码创建正确的循环/模板标记

下面是一个页面示例-

模板满足team.php

<?php /* Template Name: Meet the team */ ?>
<?php get_header(); ?>


    <section id="team">
        <div class="container">
            <div class="twelve columns">
                             <h4>MEET THE TEAM</h4>
                <div class="row">
                        <div class="four columns">
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.
                                </p> 
                        </div>        
                        <div class="four columns">
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.
                                </p>
                        </div>
                        <div class="four columns">    
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</p>
                        </div>    
                </div>

                <div class="row">
                        <div class="four columns">    
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</p>
                        </div>
                        <div class="four columns">    
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</p>
                        </div>
                        <div class="four columns">    
                                <img src="http://localhost:8888/wp-content/uploads/2017/07/tim.jpg" alt="Meet Tim" style="width:100px;height:100px;">
                                <p>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</br>Praesent sodales, leo at pellentesque pellentesque, nunc erat dapibus nunc, ut congue libero lorem in orci. Suspendisse potenti. Quisque facilisis mauris in vestibulum tempor.</p>
                        </div>
                </div>
            </div>
        </div>                
    </section>



       <?php get_template_part('form'); ?>


<?php the_content(); ?>



<?php get_sidebar(); ?>

<?php get_footer(); ?>

会见团队
Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群。

Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群。

Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群

Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群

Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群

Praesent sodales,Pelletsque的leo,nunc erat dapibus nunc,以及orci的congue libero lorem。潜力悬钩子。临时前庭的设施是毛里斯。
苏达莱斯广场,佩伦茨克佩伦茨克的利奥,奥奇的达皮布斯修女,奥奇的康格自由女神。潜力悬钩子。位于前庭颞侧的面部肌群

所有的
都需要在要编辑的页面上可用。我是否要在节标记之间创建“循环”之类的东西-

<?php
if (have_posts()):
  while (have_posts()) : the_post();
    the_content();
  endwhile;
else:
  echo '<p>Sorry, no posts matched your criteria.</p>';
endif;

您可以在WorpAddress编辑器中编写代码-只需将编辑器设置为“文本”而不是“可视”。_content()只获取编辑器。否则,我认为您需要创建一些字段-然后您可以控制将哪个字段的数据放在模板中的位置-您可以使用高级自定义字段-应该不会太难,并且您可以在不同的页面上使用该模板-例如:“我的代码建议中当然有语法错误: