View Full Version : PHP / Wordpress Question

07-03-2010, 04:47 AM
Not sure if anyone here knows enough about Wordpress to help me or not, but it is worth a shot. Thanks in advance.

I am trying to exclude a page in the nav menu on my site. I am using the Mensa Theme, and the

<?php wp_list_pages('exclude=17,38' ); ?>

Method is not working. Any ideas?

Here is some code from:


<!-- BEGIN header -->
<div id="header">

<div class="search">
<form action="<?php echo get_option('home'); ?>/">
<input type="text" name="s" id="s" value="<?php the_search_query(); ?>" />
<button type="submit">S</button>
<div class="logo">
<h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>

<li><a href="<?php echo get_option('home'); ?>">Home</a></li>
<?php dp_list_pages(); ?>

<div class="break"></div>

<!-- END header -->


# Displays a list of pages
function dp_list_pages() {
global $wpdb;
$querystr = "SELECT $wpdb->posts.ID, $wpdb->posts.post_title FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' ORDER BY $wpdb->posts.ID ASC";
$pageposts = $wpdb->get_results($querystr, OBJECT);
if ($pageposts) {
foreach ($pageposts as $post) {
?><li><a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a></li><?php

07-03-2010, 06:03 AM

Please refer to the Function Reference:


However to exclude a page from being displayed by wp_list_pages(); you need to know the correct page ids which can be found in the address bar when editing the pages in the Admin Panel on WordPress.



The end bit is the Page ID (post=309) so say I wanted to exclude 309 & 308 I would simply use the exact method you used:

<?php wp_list_pages('exclude=308,309' ); ?>

That would then exclude those two pages, I know this isn't much help but your right on tracks but it could possibly be that your not using the correct Page ID.

Hopefully this solves your issue.

07-03-2010, 07:58 AM
I did this already as I explained in my original post. It is not working for some reason. Also, I used a plugin that is supposed to do this, as well, but it did not work wither. The functions.php for this theme does not call


but rather dp_list_pages();

I tried to add the exclude argument, but nothing.