/我的wordpress站点中有几个页面应该包含一些php代码。例如,新闻页。
在我的头版。php我有一段时间可以在所有帖子中循环,打印很少的新闻。
在我的新闻网站上,我也想这样做。
我已经尝试使用
<?php /* Template Name: news */ ?>
但这只是模板,所以只有我的html在这里工作,php虽然没有输出任何数据。实现这一目标的最佳方法是什么(尽可能简单)?
编辑:
简单地说,就是如何创建静态php wordpress页面。
非常感谢。
/我的wordpress站点中有几个页面应该包含一些php代码。例如,新闻页。
在我的头版。php我有一段时间可以在所有帖子中循环,打印很少的新闻。
在我的新闻网站上,我也想这样做。
我已经尝试使用
<?php /* Template Name: news */ ?>
但这只是模板,所以只有我的html在这里工作,php虽然没有输出任何数据。实现这一目标的最佳方法是什么(尽可能简单)?
编辑:
简单地说,就是如何创建静态php wordpress页面。
非常感谢。
MahdiY只是解释一下,您可以像这样在模板中使用PHP
<?php
/*
Template Name: news
*/
get_header();
?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php
echo "This is PHP";
?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_footer(); ?>
I\'m trying to show Single Product Data in Custom Page by given Category ID but when I used the below code: <?php $args = array( \'post_type\' => \'product\', \'product_cat\' => \'category-id\' ); if ( ! defined( \'ABSPATH\' ) )