Hi everyone, does anyone know how I can exclude pages from my top menu as ive tried absalutely everything and its driving me doolaly! The code is:
[Code moderated as per the Forum Rules. Please use the pastebin]
Thanks for your time and effort.
Hi everyone, does anyone know how I can exclude pages from my top menu as ive tried absalutely everything and its driving me doolaly! The code is:
[Code moderated as per the Forum Rules. Please use the pastebin]
Thanks for your time and effort.
You might give Simply Hide Pages plugin a try.
Hi mate, cheers for the reply - I gave it a go but it hasnt worked, tried a few plug ins and none have :( I think its something in the theme code, it doesnt seem to have a wp_list_pages. Just the code above.
The 'code above' was removed according to the forum rules. Please put it in a pastebin.
Sorry new here -
<!-- ##################### PAGES MENU TOP ##################### -->
<div style="float:right;padding-right:10px">
<ul class="ul_big">
<li><a href="<?php echo get_bloginfo('siteurl');?>"><?php echo _lang('Home'); ?></a></li>
<?php
//post pages here
$s = "select ID, post_title from ".get_prefix()."posts where post_type='page' AND post_status='publish' order by post_title asc";
$r = mysql_query($s);
while($row = mysql_fetch_object($r))
{
$prm = get_permalink($row->ID);
echo '<li><a href="'.$prm.'">'.$row->post_title.'</a></li>';
}
?>
</ul>
</div>
<!-- ##################### END PAGES MENU TOP #####################One way to do this is to add a clause to the select, excluding the IDs of the posts. Assuming you want to exclude IDs 11,22,33 and 55, you would change this:
$s = "select ID, post_title from ".get_prefix()."posts where post_type='page' AND post_status='publish' order by post_title asc";
$r = mysql_query($s);
to this:
$s = "select ID, post_title from ".get_prefix()."posts where post_type='page' AND post_status='publish' ";
$s .= "AND ID NOT IN (11,22,33,55) order by post_title asc";
$r = mysql_query($s);Cheers for the code -
Just to confirm the page Id can be found in the edit page primalink?
Ive tried the code, it doesnt seem to be working as when I change the page IDs, it just removes every page from the menu exceot the home.
Please check the code very carefully. Make sure there is a space between the single and double quotes near the end of the first line:
post_status='publish' ";
and that the second line uses 'dot-equal', not just 'equal':
$s .=
Ill give it a go mate, but im not to certain about my IDs they're not numbers anymore as i changed them in the Primalink section, so instead of i.e. ID 12 its Business-directory
so id replace the ID number with the label insteaD?
You need to use the numbers, not the permalinks.
If you go to Admin->Pages, and then click 'Edit' under a Page title, you should see the Page Id in the address bar at the top of the browser window. It will be something like:
http://yoursite.com/wp-admin/post.php?post=123&action=edit
The number after '?post=' is the ID for that Page.
You can also see the ID by just hovering the pointer over the Edit link and looking in the status bar at the bottom of the browser window.
Ah mate you're a star! nice one fella - its worked, thanks for all your help bud :D
You must log in to post.