I have some links in my home page that i want to force them to open in the index.php instead of single.php.
Is that possible ?
<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() ?>
If you just mean to redirect a single page with id = $postid
to index page then this would do : -
function redirect_postid_to_index() {
if(is_single('$postid')){
header(bloginfo('url'));
exit;
}
}
add_action('init','redirect_postid_to_index');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.