Display Conditional Pages


I have been trying to exclude buddypress pages from wp_nav_menu.

function get_ID_by_page_name() {
global $wpdb;
$page_name = array('Activity','Forums','Groups','Members','Register','Activate');
//print_r($page_name);
for($i=0;$i<sizeof($page_name);$i++)
{
//echo $page_name[$i];
$page_name_id = $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_name = '".$page_name[$i]."' AND post_type = 'page'");
?>
<style>
.page-item-<?php echo $page_name_id; ?> {display:none; }
</style>
<?php
}
}
echo get_ID_by_page_name();
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s