如何强制循环/链接使用Index.php而不是Single.php
我的主页上有一些链接,我想强制它们在index.php而不是single.php中打开 可能吗如何强制循环/链接使用Index.php而不是Single.php,php,html,wordpress,Php,Html,Wordpress,我的主页上有一些链接,我想强制它们在index.php而不是single.php中打开 可能吗 <div id="RightBar"> <?php query_posts('category_name=new_publish&showposts=100'); ?> <?php while (have_posts()) : the_post(); ?> <a class="Publish_Num" href="<?php echo g
<div id="RightBar">
<?php query_posts('category_name=new_publish&showposts=100'); ?> <?php while (have_posts()) : the_post(); ?>
<a class="Publish_Num" href="<?php echo get_post_permalink(); ?> ">
<?php echo rwmb_meta( '_mb_monthly_number'); ?>
</a>
<?php endwhile;?>
</div>
<?php wp_reset_query() ?>
如果您只是想将id=
$posted
的单个页面重定向到索引页面,那么这将可以:-
function redirect_postid_to_index() {
if(is_single('$postid')){
header(bloginfo('url'));
exit;
}
}
add_action('init','redirect_postid_to_index');
“我想强迫他们打开”是什么意思?我想重定向到索引页的帖子数量不是固定的。它将增加,因为它的每月出版数量。所以一个月后,我会有一篇新的文章,我想重定向到index.php。然后你可以为它制作一个模板,你可以将该模板分配给你的每一篇文章。该模板将包含重定向代码。