我正在使用Wordpress主题项目,我需要帮助。如何添加页面slug名称作为php导入文件的名称?
示例:
( <?php echo basename(get_permalink()); ?> - This gets the page slug name )
<?php include '(slug name).php'; ?>
=
<?php include '<?php echo basename(get_permalink()); ?>.php'; ?>
答案 0 :(得分:4)
include
和echo
都是PHP语句,不需要将它们包装在PHP标记中两次。
<?php include basename(get_permalink()) . '.php'; ?>
答案 1 :(得分:1)
<button class="btn btn-primary" type="button" data-toggle="collapse" data- target="#collapseExample" aria-expanded="true" aria-controls="collapseExample">
Button with data-target
</button>
<div class="collapse in" id="collapseExample">
<div class="well">
asf sdf adsf asdf fd asdf
</div>
</div>