我有博客和案例页面的网站,例如example.com/blog和example.com/cases,目前我已经安装了两个带有专用数据库的wordpress,这是正确的方法吗?是否有任何创建两个博客帖子页面的选项,我不想在博客部分和博客部分帖子中显示案例,两者都不同,当用户查看它应该在子目录下。例如:example.com/blog/post-1和example.com/cases/post-23。
有什么办法合并数据库至少?
谢谢
答案 0 :(得分:0)
用于显示您"案例"中的最近5个帖子页。创建一个新的cases.php页面,并将以下代码行放在此PHP页面中,并将其放在主题目录中。并为"案例"分配页面模板。 WordPress页面。
<?php
/* Template Name: Cases */
$args = array(
'post_type' => array( 'cases' ),
'posts_per_page' => 5,
);
$my_query = new WP_Query( $args );
if( $my_query->have_posts() ) :
while ( $my_query->have_posts() ) : $my_query->the_post(); ?>
<div class="smal-sec">
<h3><?php the_title();?></h3>
<?php the_content();?>
</div>
<?php
endwhile;
endif;
wp_reset_query(); // Restore global post data stomped by the_post().
?>