开发者

wordpress parent & Child Menu

开发者 https://www.devze.com 2022-12-31 14:55 出处:网络
Is it possible to have the Parent menu to be redirected to the child menu? As an example I want this parent item page to redirect to it\'s children page.

Is it possible to have the Parent menu to be redirected to the child menu?

As an example I want this parent item page to redirect to it's children page.

My code for displaying pages as the Main Menu:

<?php wp_list_pages('exclude=3&sort_column=menu_order&title_li=&depth=1'); ?>

here is my code for listing the children menu:

<div id="leftCol">
<?php if($post->post_parent)
$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");开发者_开发百科 else
$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
if ($children) { ?>
<ul>
<?php echo $children; ?>
</ul>
<?php } else { ?>
<?php } ?>
</div>


it looks like it's already doing that, based off of clicking through your links. However, the easiest way to do a redirect like what you are asking for is by simply using Redirection to generate a 301 redirect. You won't have to mess with your code and you can turn it off and on at any time.

0

精彩评论

暂无评论...
验证码 换一张
取 消