所以我创建了一个定制的post类型,我还创建了一个名为page-profile.php的定制页面,它遵循WordPress模板。
下面是page-profile.php内部的代码:
'profile', // enter custom post type
'orderby' => 'title',
'order' => 'ASC',
'posts_per_page' => '4',
);
$loop = new WP_Query($args);
get_header(); // displays header
get_sidebar();
get_footer(); //displays footer所以页眉、页脚和侧边栏都被调用了。
如何锁定红色框并创建模板,以便显示标题和缩略图?

发布于 2020-01-21 07:23:40
您需要将the Loop添加到模板中以显示post内容。
常规循环(当前页)。
自定义查询循环。注意wp_rest_postdata()
have_posts()) : ?>
have_posts()) : $loop->the_post(); ?>您还可以在循环中使用get_template_part(),如果您希望将代码拆分为较小的部分和单独的文件。
https://wordpress.stackexchange.com/questions/356828
复制相似问题