How to exclude certain entries?
Posted: Wed Jul 06, 2011 8:00 am
Hi,
I have a table for pages and I am listing them in the navbar. I want to exclude certain pages, how can I do that?
Here is the function I'm using to get the pages.
I have a table for pages and I am listing them in the navbar. I want to exclude certain pages, how can I do that?
Here is the function I'm using to get the pages.
function get_pages() { $pages = array(); $query = mysql_query("SELECT `posts`.`id` AS `post_id`, `post_title`, `post_name`, `post_body` FROM `posts` WHERE `post_type` = 'page' ORDER BY `post_id` ASC"); while ( $row = mysql_fetch_assoc($query)) { $pages[] = $row; } return $pages; }and here is the code that I use to list them:
<?php foreach (get_pages() as $page) { ?> <li><a href="page.php?p=<?php echo $page['post_name']; ?>"><?php echo $page['post_title']; ?></a></li> <?php } ?>