WordPress.org

Ready to get started?Download WordPress

Forums

Excluding a Page with a Php Variable (1 post)

  1. theliztaylor
    Member
    Posted 2 years ago #

    Hi --

    I'm doing what I think should be pretty simple, trying to exclude a page to be listed by using a php variable. However, it isn't working, all the pages are still displaying. I'm doing this, because I want to display the current page in a different style than the other pages. Here is my code:

    <h1>
    			<ul><span style="font-size: 32px; margin-left: -10px;">
    			<?php
    
    if ( is_page('Identity') ) { $current = 'Identity'; $number = 2; }
    elseif ( is_page('Connect') ) { $current = 'Connect'; $number = 6; }
    elseif ( is_page('Shop') ) { $current = 'Shop'; $number = 8; }
    elseif ( is_page('In the Spotlight') ) { $current = 'In the Spotlight'; $number = 10;}
    elseif ( is_page('Compendium of Dreams') ) { $current = 'Compendium of Dreams'; $number = 12;}
    
    echo $current; 
    
    ?>
    	</span>
    	</ul>
    
    	<ul style="float: right; text-align: right; margin-top: 5px;">
    
    <?php wp_list_pages('sort_column=menu_order&title_li=&exclude="$number"'); ?>
    </ul></h1>

    Thanks for any help!!

Topic Closed

This topic has been closed to new replies.

About this Topic