Forums

[resolved] Need Help with the Exclude code (3 posts)

  1. hazelbug
    Member
    Posted 1 year ago #

    Hi,
    Here is the site I am working on. I need to exclude certain pages, but I don't know how to add it to the code.

    When I tried to alter the `<?php wp_list_pages('exclude=17,38' ); ?>
    ` it messes up the page.

    The code looks a bit different so I tried to also add
    get_page_by_title('3x5 Rugs')->ID, to the code bc it looked like they were excluding certain pages that way.

    Here is the PHP Code

    <?php wp_head(); ?>
    </head>
    <body>
    	<div id="page">
    		<div id="header">
    			<div id="headerimg">
    				<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
    				<div id="description"><?php bloginfo('description'); ?></div>
    				<div id="menu">
    					<ul>
    						<?php
    $page_ids = array(get_page_by_title('Mailing List')->ID,
                                                                                                                                                                    get_page_by_title('Newsletter')->ID);
    
    							$page_ids = join(', ', $page_ids);
    							$args = array('title_li' => '', 'exclude' => $page_ids);
    							wp_list_pages($args);
    						?>
    					</ul>
    				</div>
  2. viceng
    Member
    Posted 1 year ago #

    Hi,

    I think you need something like

    <?php wp_list_pages('title_li=&sort_column=menu_order&exclude=62,75'); ?>

    I believe you left out the 'title_li= part.

  3. hazelbug
    Member
    Posted 1 year ago #

    Thank you!

Topic Closed

This topic has been closed to new replies.

About this Topic