• Hello,

    I want to exclude some pages from navigation and I can’t do it with this theme.

    The Header code is:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="https://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    
    <!-- BEGIN html head -->
    <head profile="https://gmpg.org/xfn/11">
    
    	<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
    	<title><?php bloginfo('name'); ?> <?php wp_title(); ?></title>
    
    	<link rel="alternate" type="application/rss+xml" title="<?php bloginfo('name'); ?> RSS Feed" href="<?php if (strlen(fs_settings('subscribe'))>0) echo fs_settings('subscribe'); else bloginfo('rss2_url'); ?>" />
    	<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
    
    	<!-- begin stylesheets -->
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/style.css" />
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/styles/<?php echo fs_settings('theme_color'); ?>/style.css" />
    	<link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/lightbox.css" />
    	<!-- end stylesheets -->
    
    	<!--[if lt IE 7]><link rel="stylesheet" type="text/css" href="<?php bloginfo('template_url'); ?>/assets/css/ie6.css" /><![endif]-->
    	<!--[if lte IE 7]><script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/unitpngfix.js"></script><![endif]-->
    
    	<!-- begin javascript -->
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/javascript.php"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/jquery-1.3.2.min.js"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/scripts.js"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/sidebartabs.js"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/prototype.js"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/scriptaculous.js?load=effects,builder"></script>
    	<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/assets/js/lightbox.js"></script>
    	<!-- end javascript -->
    
    	<?php if (function_exists('wp_enqueue_script') && function_exists('is_singular')) : ?>
    	<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
    	<?php endif; ?>
    	<?php wp_head(); ?>
    <meta name="google-site-verification" content="XOF6XQIKj1vYsaXd6w4a3JheGkg1MVb_jkzSzLQ9leA" />
    </head>
    <!-- END html head -->
    
    <body>
    
    <!-- BEGIN wrapper -->
    <div id="wrapper">
    
    	<!-- BEGIN header -->
    	<div id="header">
    		<h1><a href="<?php echo get_option('home'); ?>"><?php bloginfo('name'); ?></a></h1>
    		<?php if (fs_settings('advertise_468x60_s')=='enabled') : ?>
    		<div class="ad"><?php echo fs_settings('advertise_468x60'); ?></div>
    		<?php endif; ?>
    		<div class="pages">
    		<?php fs_list_pages(); ?>
    		</div>
    		<div class="categories">
    		<?php fs_list_categories(0, get_cat_ID(fs_settings('featured_name'))); ?>
    		</div>
    	</div>
    	<!-- END header -->
    
    	<div class="break"></div>
    
    	<!-- BEGIN body -->
    	<div id="body">
Viewing 3 replies - 1 through 3 (of 3 total)
  • fs_list_pages(); seems to be a theme specific function; you can maybe find it in functions.php of your theme.

    if you are lucky, it is using wp_list_pages() inside of this function, where you can exclude your pages.

    what theme are you using?

    or have you tried to use the exclude parameter with the given function?
    for instance:
    <?php fs_list_pages('exclude=31,57'); ?>

    Thread Starter chewie49

    (@chewie49)

    Hi,

    I am using QuickRise (Themeforest)

    I tried <?php fs_list_pages('exclude=31,57'); ?> but It blew up ALL pages from the menu.

    I took a look at the function.php and I dont know what to do.

    The code is this:

    <?php
    
    include("settings.php");
    
    # Displays language
    function fs_lang($key, $echo=true) {
    	include(dirname(__FILE__).'/language/' . fs_settings('language') . '.php');
    	if ($echo) echo $lang[$key];
    	else return $lang[$key];
    }
    
    # WIDGET: Top Sidebar
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => fs_lang("Top Sidebar", false),
            'before_title' => '<h2>',
            'after_title' => '</h2>',
    		'before_widget' => '<div class="box">',
            'after_widget' => '</div>',
        ));
    # WIDGET: Left Sidebar
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => fs_lang("Left Sidebar", false),
            'before_title' => '<h2>',
            'after_title' => '</h2>',
    		'before_widget' => '<div class="box">',
            'after_widget' => '</div>',
        ));
    
    # WIDGET: Right Sidebar
    if ( function_exists('register_sidebar') )
        register_sidebar(array(
    		'name' => fs_lang("Right Sidebar", false),
            'before_title' => '<h2>',
            'after_title' => '</h2>',
    		'before_widget' => '<div class="box">',
            'after_widget' => '</div>',
        ));
    
    # Displays a list of pages
    $fs_first = true;
    function fs_list_pages($parent=0) {
    	global $fs_first;
    	$pages = fs_get_pages($parent);
    	if (count($pages)>0) {
    		?><ul><?php
    		foreach ($pages as $page) {
    			if ($page->id>0) {
    				if ($fs_first) {
    					?><li><a href="<?php echo get_option('home'); ?>"><?php fs_lang('Home'); ?></a><?php
    					$fs_first = false;
    				}
    				?><li<?php if ($count<1) echo ' class="f"'; ?>><a href="<?php echo get_permalink($page->id); ?>"><?php echo $page->title; ?><?php if (fs_has_subpages($page->id)) echo ' &raquo;'; ?></a>
    				<?php $count = fs_list_pages($page->id); ?>
    				</li><?php
    			}
    		}
    		?></ul><?php
    	}
    	$count++;
    	return $count;
    }
    
    # Returns a list of pages
    function fs_get_pages($parent=0) {
    	global $wpdb, $wp_query;
    	$querystr = "SELECT $wpdb->posts.ID AS <code>id</code>, $wpdb->posts.post_title AS <code>title</code> FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_parent = $parent ORDER BY $wpdb->posts.menu_order, $wpdb->posts.post_title ASC";
    	$pageposts = $wpdb->get_results($querystr, OBJECT);
    	return $pageposts;
    }
    
    # Determines whether page has children.
    function fs_has_subpages($id) {
    	global $wpdb, $wp_query;
    	$querystr = "SELECT COUNT($wpdb->posts.ID) AS <code>count</code> FROM $wpdb->posts WHERE $wpdb->posts.post_parent = $id AND $wpdb->posts.post_type = 'page' AND $wpdb->posts.post_status = 'publish'";
    	$count = $wpdb->get_results($querystr, OBJECT);
    	return $count[0]->count;
    }
    
    # Displays a list of categories
    function fs_list_categories($parent=0, $exclude='0') {
    	$categories = fs_get_categories($parent, $exclude);
    	if (count($categories)>0) {
    		?><ul><?php
    		foreach ($categories as $category) {
    			if ($category->id>0) {
    				?><li><a href="<?php echo get_category_link($category->id); ?>"><?php echo $category->name; ?><?php if (fs_has_subcats($category->id)) echo ' &raquo;'; ?></a>
    				<?php fs_list_categories($category->id, $exclude); ?>
    				</li><?php
    			}
    		}
    		?></ul><?php
    	}
    }
    
    # Returns a list of categories
    function fs_get_categories($parent=0, $exclude) {
    	global $wpdb, $wp_query;
    	$querystr = "SELECT $wpdb->term_taxonomy.term_id AS <code>id</code>, $wpdb->terms.name FROM $wpdb->term_taxonomy LEFT JOIN $wpdb->terms ON $wpdb->term_taxonomy.term_id = $wpdb->terms.term_id WHERE $wpdb->term_taxonomy.parent = $parent AND $wpdb->term_taxonomy.taxonomy = 'category' AND $wpdb->term_taxonomy.term_id NOT IN ($exclude) AND $wpdb->term_taxonomy.count > 0 ORDER BY $wpdb->term_taxonomy.term_id";
    	$categories = $wpdb->get_results($querystr, OBJECT);
    	return $categories;
    }
    
    # Determines whether category has subcategories
    function fs_has_subcats($id) {
    	global $wpdb, $wp_query;
    	$querystr = "SELECT COUNT($wpdb->term_taxonomy.term_id) AS <code>count</code> FROM $wpdb->term_taxonomy WHERE $wpdb->term_taxonomy.parent = $id";
    	$count = $wpdb->get_results($querystr, OBJECT);
    	return $count[0]->count;
    }
    
    # Determines whether sub is child of parent
    function fs_sub($sub, $parent) {
    	global $wpdb;
    	$querystr = "SELECT $wpdb->posts.ID FROM $wpdb->posts WHERE $wpdb->posts.post_parent = $parent";
    	$subpages = $wpdb->get_results($querystr, OBJECT);
    	foreach ($subpages as $v) {
    		if ($sub==$v->ID) return true;
    	}
    	return false;
    }
    
    # Displays post image attachment (sizes: thumbnail, medium, full)
    function fs_attachment_image($postid=0, $size='articleimg', $attributes='') {
    	if ($postid<1) $postid = get_the_ID();
    	$custom = get_post_meta($postid, 'articleimg', true);
    	if (strlen($custom)>0) {
    		?><img src="<?php echo $custom; ?>" <?php echo $attributes; ?> /><?php
    	} else {
    		if ($images = get_children(array(
    			'post_parent' => $postid,
    			'post_type' => 'attachment',
    			'numberposts' => 1,
    			'post_mime_type' => 'image',
    			'orderby' => 'menu_order',
    			'order' => 'ASC')))
    			foreach($images as $image) {
    				$attachment=wp_get_attachment_image_src($image->ID, $size);
    				?><img src="<?php echo $attachment[0]; ?>" <?php echo $attributes; ?> /><?php
    			}
    	}
    }
    
    # Removes tags and trailing dots from excerpt
    function fs_clean($excerpt, $substr=0) {
    	$string = strip_tags(str_replace('[...]', '...', $excerpt));
    	if ($substr>0) {
    		$string = substr($string, 0, $substr);
    	}
    	return $string;
    }
    
    # Displays the comment authors gravatar if available
    function fs_gravatar($size=50, $attributes='', $author_email='') {
    	global $comment, $settings;
    	if (fs_settings('gravatar')=='enabled') {
    		if (empty($author_email)) {
    			ob_start();
    			comment_author_email();
    			$author_email = ob_get_clean();
    		}
    		$gravatar_url = 'https://www.gravatar.com/avatar/' . md5(strtolower($author_email)) . '?s=' . $size . '&d=' . fs_settings('gravatar_fallback');
    		?><img src="<?php echo $gravatar_url; ?>" <?php echo $attributes ?>/><?php
    	}
    }
    
    # Retrieves the setting's value depending on 'key'.
    function fs_settings($key) {
    	global $settings;
    	return $settings[$key];
    }
    
    # Displays a list of popular posts
    function fs_popular_posts($num, $pre='<li>', $suf='</li>', $excerpt=true) {
    	global $wpdb, $post;
    	$querystr = "SELECT $wpdb->posts.post_title, $wpdb->posts.comment_count, $wpdb->posts.ID, $wpdb->posts.post_content FROM $wpdb->posts WHERE $wpdb->posts.post_status = 'publish' AND $wpdb->posts.post_type = 'post' ORDER BY $wpdb->posts.comment_count DESC LIMIT $num";
    	$myposts = $wpdb->get_results($querystr, OBJECT);
    	foreach($myposts as $post) {
    		echo $pre;
    		?>
    		<?php if (fs_settings('popular_thumb')=='enabled') : ?>
    		<?php fs_attachment_image($post->ID, 'thumbnail', 'alt="' . $post->post_title . '"'); ?>
    		<?php endif; ?>
    		<a href="<?php echo get_permalink($post->ID); ?>"><?php the_title(); ?></a>
    		<p><?php echo fs_clean($post->post_content, 100); ?>...</p>
    		<?php
    		echo $suf;
    	}
    }
    
    # Limits text to a certain number of words.
    function fs_words($string, $num) {
    	$matches = array();
    	if (preg_match("/^(\W*\b\w+\b){1,$num}/", $string,
    	$matches)) {
    		 $result = trim($matches[0]);
    		 return $result;
    	}
    }
    
    # Show excerpt in number of words
    function fs_excerpt($string, $num) {
    	$string = preg_replace('/\<img .*\/>/', '', $string);
    	$string = str_replace('<p>', '', $string);
    	$string = str_replace('</p>', '', $string);
    	echo trim(fs_words($string, $num));
    }
    
    # Comments template
    function mytheme_comment($comment, $args, $depth) {
    	$GLOBALS['comment'] = $comment; ?>
    	<li <?php comment_class(); ?> id="comment-<?php comment_ID() ?>">
    
    	<?php
    	$comment_type = get_comment_type();
    	if($comment_type == 'trackback') :
    		?><p class="trackback"><?php fs_lang("Trackback"); ?>: <?php echo get_comment_author_link() ?></p><?php
    	else :
    	?>
    		<div class="comment1">
    		<?php echo get_avatar($comment,$size='30'); ?>
    		<div class="details">
    		<p class="author"><?php echo get_comment_author_link() ?></p>
    		<?php if ($comment->comment_approved == '0') : ?>
    		<p class="mod"><?php fs_lang("Your comment is awaiting moderation."); ?></p>
    		<?php endif; ?>
    		<p class="date"><?php printf(__('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?> <?php edit_comment_link(__('Edit'),' &nbsp; ','') ?>
    		</p>
    		</div>
    		<div class="commenttext"><?php comment_text() ?></div>
    		<div class="reply">
    		<?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
    		</div>
    		</div>
    		<?php
    	endif;
    }
    
    # Trackbacks template
    function mytheme_ping($comment, $args, $depth) {
    	$GLOBALS['comment'] = $comment; ?>
    	<li id="comment-<?php comment_ID() ?>">
    	<?php echo get_comment_author_link() ?>
    	<em><?php printf(__('%1$s at %2$s'), get_comment_date('m-d-Y'),  get_comment_time()) ?></em>
    	<?php
    }
    
    ?>

    I appreciate any help.

    Thanks!!

    Thread Starter chewie49

    (@chewie49)

    I tried removing the fs_list_pages() in the Function.php but I did soemthing wrong because I damaged the website and I had to restore it.

    I really dont know what to do… ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I can’t exclude pages from this code’ is closed to new replies.