Hi,
In my site, http://searchbyssn.org I'm having a problem that my pages are automatically added as buttons to the menu. how do I solve that?
Hi,
In my site, http://searchbyssn.org I'm having a problem that my pages are automatically added as buttons to the menu. how do I solve that?
I think you have a pages plugin in your sidebar. Remove it and use the "blogroll"/"links" function and widget to link to the pages you want.
Hi,
One option is to can use a plugin (e.g. Page Lists Plus, or Exclude Pages) that lets you choose which Pages appear in your Page menus.
- Tim
I'm afraid I wasn't clear.
The pages are added to my top menu, not the sidebar. How do I remove them and leave only the "home" button.
Open your header.php and remove the arguments you don't want. Alternally, Techno's plugins will do the trick too.
How do I remove them and leave only the "home" button.
You would delete wp_list_pages code in your header.php in main navigation
Edit- if your home link was deleted along with that, then add
<li><a href="<?php echo get_option('home'); ?>/">Home</a></li>
mercime,
I didn't have "wp_list_pages" code in my header.php
I did have
<ul class="artmenu">
<?php art_menu_items(); ?>
<div class="l"></div>
and when I changed the <?php art_menu_items(); ?> with the code you mentioned, the top menu wasn't what I hoped for (you can take a look: http://searchbyssn.org)
Gangleri,
I'm not sure what "arguments" are, but this is how my header.php looks now:
<div class="Main">
<div class="Sheet">
<div class="Sheet-tl"></div>
<div class="Sheet-tr"><div></div></div>
<div class="Sheet-bl"><div></div></div>
<div class="Sheet-br"><div></div></div>
<div class="Sheet-tc"><div></div></div>
<div class="Sheet-bc"><div></div></div>
<div class="Sheet-cl"><div></div></div>
<div class="Sheet-cr"><div></div></div>
<div class="Sheet-cc"></div>
<div class="Sheet-body">
<div class="Header">
<div class="Header-c"></div>
<div class="logo">
<h1 id="name-text" class="logo-name">/"><?php bloginfo('name'); ?></h1>
<div id="slogan-text" class="logo-text"><?php bloginfo('description'); ?></div>
</div>
</div>
<div class="nav">
<ul class="artmenu">
<div class="l"></div>
<div class="r"><div></div></div>
Hm, these theme developers make things more and more complex. Yours used the function.php for the list_pages (function art_list_pages_filter($output)) which seems to be called by this in your header.php: elseif (is_page() ), but I am not sure about that! Mercime?
Did you already try the two plugins that Technokinetics mentioned?
I did try them and they didn't work on the top menu.
That's weird, since the plugins claim to handle the list_pages, not specifically a widget. Maybe you can look a bit further for similar plugins and/or contact your theme author for tips.
these plugins only handle the sidebar list_pages. I think there is a different function to put the pages in the top menu.
In your theme it's different from what I'm used to indeed....
The plugins modify WP's native wp_list_pages() function, which in most cases should be used to generate Page lists. If a theme uses its own custom functions instead of native WP functions, then users shouldn't expect plugins to work with it.
Why do so many developers use custom functions when there are native functions that will do?
- Tim
If I will post here the functions.php will you be able to find the source of this issue?
@Gangleri, @Technokinetics - personally, I have changed "premium" WP themes with all the propriety functions to regular themes for clients with the same functionality. Kept in attribution link to theme developer's site ... after all, CSS and images are theirs :-) I believe many theme developers use custom functions so that they can retain GPL status while being able to charge for support in order to make a living by creating killer themes :-) Can't blame themers though, I've noticed great themes being distributed by those wordpress theme sites which change attributions and even add obfuscated code at the footer.php or functions.php or header.php - okay, i feel better after that rant :-)
ezgold - you are not limited to the functions given in your theme. You can still do the main navigation as we started out. It's simplified like this:
<div class="nav">
<ul class="artmenu">
<li><a href="http://searchbyssn.org/">Home</a></li>
<?php wp_list_pages('title_li='); ?>
</ul>
<div class="l"></div>
<div class="r"><div>
</div>
- don't know what that div class l or r are for or why they're there :-)
Then do either of these ways to control your main navigation:
1) Plugin way - http://wordpress.org/extend/plugins/exclude-pages/
With exclude pages plugin, there's an option to exclude that page in your Pages > Add New - Panel from your main horizontal navigation. So even if you change your theme, the excluded pages won't be appearing in your new theme's main navigation as well.
2) <?php wp_list_pages('title_li='); ?> - without using any plugin, you can exclude the page from your main navigation by excluding pages via Page ID e.g.
<?php wp_list_pages('title_li=&exclude=3,6,100,200'); ?>
In this case, if you change your theme, copy your main nav links to your new theme.
3) Hardcode all the main navigation links. If you have only five main links, easy way to go.
<div class="nav">
<ul class="artmenu">
<li><a href="http://searchbyssn.org/">Home</a></li>
<li><a href="http://searchbyssn.org/about/">About</a></li>
<li><a href="http://searchbyssn.org/terms-of-service/">Terms Of Service</a></li>
<li><a href="http://searchbyssn.org/privacy">Privacy</a></li>
<li><a href="http://searchbyssn.org/contact/">Contact</a></li>
</ul>
<div class="l"></div>
<div class="r"><div>
</div>
In this case, if you change your theme, copy your main nav links to your new theme.
Were you off during the weekend?
Anyone have an idea?
Were you off during the weekend?
What do you mean by that? Are the ways I listed above not working for you?
Mercime, I didn't see your suggestion when I wrote the last comment.
Unfortunately your suggestion didn't help since when I remove the <?php art_menu_items(); ?> The top-menu buttons disappear and all I see is links (you can see the button now - I changed it back to how it was).
http://searchbyssn.org
I did add the exclude pages and I can control the side bar and the top menu. But I still can't control them separately. I want the top menu to have certain links(buttons) and the side bar to have different links.
If you want different links in the two menus, then I don't think either Exclude Pages or Page Lists Plus will get you there.
To specify which pages appear in your top menu without losing the button states, try replacing the <?php art_menu_items(); ?> function call in your header.php theme file with this:
<?php
$page_list = wp_list_pages('title_li=&sort_column=menu_order&echo=0&include=1,2,3');
$page_list = preg_replace('<code><a(.+)</a></code>', '<a$1</span></span></a>', $page_list);
$page_list = preg_replace('<code><a(.+)"></code>', '<a$1"><span><span>', $page_list);
echo $page_list;
?>
Replace "1,2,3" with a comma-separated list of the IDs of the pages that you'd like to include there.
For your sidebar, this should do if you want to specify which pages do appear there:
<?php wp_list_pages(title_li=&sort_column=menu_order&include=1,2,3); ?>
Alternatively, use this to specify which pages don't appear there:
<?php wp_list_pages(title_li=&sort_column=menu_order&exclude=1,2,3); ?>
Hope that works. Let us know how you get on.
- Tim
One slight problem with the code above: Where you see code tags replace them with a backticks (a bit like a single quote, usually on the key to the left of the 1 key).
- Tim
do you mean replace with ` ?
Where do I place the code for the sidebar? in the sidebar.php?
do you mean replace with ` ?
do you mean that I need to replace <code> with `?
Yes, replace <code> / </code> with backticks.
And your sidebar menu code will probably be in your sidebar.php theme file (but you'll need to take a different approach if you're using a dynamic sidebar/widgets).
- Tim
I tried the code you gave me and I got an error:
Parse error: syntax error, unexpected $end in..../html/searchbyssn.org/wp-content/themes/pigskin/header.php on line 56
Will this code let me keep the "home" button in the top menu as well?
Posting code can be a little tricky here (as you can see from the broken thread layout). If you email me your header.php theme file at tim @ technokinetics.com then I'll email it back with the code in place.
- Tim
Tim helped me solve it!
Thank you!
I was trying to remove certain links from my header menu, and from my pages sidebar menu. With a combination of the wp-list-pages, exclude and the Pages List Plus plugin, I have finally got my menus all working exactly as I wanted them. This has been the bane of my life for months now. Thank you so much for all the help listed above!
I had the same issue as ezgold. I wanted to set a static page for my blog and not have it show as Home twice in the top navigation menu. My header called the menu with:
<?php art_menu_items(); ?>
With the information above, I found the call in the functions.php file
. $homeMenuItemCaption . '</span></span></a></li>';
add_action('get_pages', 'art_header_page_list_filter');
add_action('wp_list_pages', 'art_list_pages_filter');
wp_list_pages('title_li');
remove_action('wp_list_pages', 'art_list_pages_filter');
remove_action('get_pages', 'art_header_page_list_filter');
I changed the following line to exclude the new Home page and it is now working fine.
wp_list_pages('title_li=&exclude=3');
Hope that helps someone down the road.
This topic has been closed to new replies.