Help with sections of pages in Wordpress

benjamin.morgan

New Member
I have a main nav horizontal with the
HTML:
wp_list_pages('depth=1&title_li=<h2 class="displaynone">Pages</h2>);
On the commercial page (on main navigation) I need to have a vertical sidebar only on this page. I don't know how to make it where he can add pages to it like that. So far when it creates a page it adds it to the main nav bar


I tried doing an If statement. It didn't work. For some reason the only thing it is putting on the sidebar is the word Commercial
HTML:
<?php
if(trim(wp_title(''))=="Commercial") {
?>
<ul class="comside">
<?php
        $recent_posts = wp_get_recent_posts();
        foreach($recent_posts as $recent){
                echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .  $recent["post_title"].'</a></li> ';
        }
?>
</ul>
<?php }?>
 
Last edited:

benjamin.morgan

New Member
Okay I solved that. I will just go with posts as pages. Now on the index page which is the About Us page i want to be able to display a header.

<?php
if(trim(wp_title('', false))=="") {
echo "<h1>About Us</h1>";
}
?>


Now that isn't working.
 

benjamin.morgan

New Member
HTML:
<?php
 if(trim(wp_title(""))!="") {
 trim(wp_title(""));
 ?>
 <?php
echo  " - ";?>
 <?php
 bloginfo('name');
 } else {
  bloginfo('name');
 }
?>
I want it to on the index page just display name of site. On the other pages i want it to say Commercial - Site name. It is currently saying CommercialSite name and smashing it together. Do you see the problem?
Now that isn't working.
 

DOAWebDesigns

New Member
Easy way of doing this.

I have a main nav horizontal with the
HTML:
wp_list_pages('depth=1&title_li=<h2 class="displaynone">Pages</h2>);
On the commercial page (on main navigation) I need to have a vertical sidebar only on this page. I don't know how to make it where he can add pages to it like that. So far when it creates a page it adds it to the main nav bar


I tried doing an If statement. It didn't work. For some reason the only thing it is putting on the sidebar is the word Commercial
HTML:
<?php
if(trim(wp_title(''))=="Commercial") {
?>
<ul class="comside">
<?php
        $recent_posts = wp_get_recent_posts();
        foreach($recent_posts as $recent){
                echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .  $recent["post_title"].'</a></li> ';
        }
?>
</ul>
<?php }?>


Use the exclude pages plugin. It's a great plugin that will allow you to choose which pages no to show in the main navigation. I use it all the time. Then do as you did with the if statement to show your sidebar.
 
Top