Web Design Forum  
 
Go Back   Web Design Forum > Web Software > Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 12-18-2011, 01:45 PM   #1
Silver Member
 
benjamin.morgan's Avatar
 
Join Date: Aug 2011
Posts: 187
Default Help with sections of pages in Wordpress

I have a main nav horizontal with the
HTML Code:
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 Code:
<?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 by benjamin.morgan; 12-18-2011 at 01:46 PM. Reason: Change title to add wordpress
benjamin.morgan is offline   Reply With Quote


Old 12-18-2011, 02:09 PM   #2
Silver Member
 
benjamin.morgan's Avatar
 
Join Date: Aug 2011
Posts: 187
Default

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 is offline   Reply With Quote
Old 12-18-2011, 02:16 PM   #3
Silver Member
 
benjamin.morgan's Avatar
 
Join Date: Aug 2011
Posts: 187
Default

HTML Code:
<?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.
benjamin.morgan is offline   Reply With Quote
Old 12-19-2011, 03:29 PM   #4
New Member
 
DOAWebDesigns's Avatar
 
Join Date: Dec 2011
Posts: 18
Default Easy way of doing this.

Quote:
Originally Posted by benjamin.morgan View Post
I have a main nav horizontal with the
HTML Code:
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 Code:
<?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.
__________________
DOA Web Designs Like us and follow Facebook Twitter
DOAWebDesigns is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:50 AM.


Camera Forum - Computer Forum - Web Design Forum

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
Content Relevant URLs by vBSEO 3.6.0 ©2011, Crawlability, Inc.