in order to show a page in the navigation bar, does it have to be added from the admin dashboard or can it I just upload the page to the current theme folder. For example, can I just write code in the ‘header.php’ to get ‘porfolio.php’ without having that page added under the admin dashboard>add page
Yeah you can add your own links to the navigation without going through the dashboard, I did it with an HTML page in header.php, but php should work. I forget the exact process, but you can copy the original php page into notepad and experiment. But why would you want to exclude it from the dashboard? It will be harder to make any changes to it.
well to start off, my nav bar is very customized in the sense that I need a <li id="something"> for each one of them. You are right, i guess i can write a whole page including any html in the dashboard>page. Back to the problem, I cant use direct html links as they would be wp-content/theme/testingtheme/ and that wouldnt look professional plus the fact that WordPress wont let me do that. Any chance you can tell me the code you used? thanks
As far as I remember it looked like this, but I used it a while back so I'm not to sure how it works. <li><a rel="nofollow" href="<?php echo get_option('home'); ?>"><?php _e("Home", 'studiopress'); ?></a></li> <?php wp_list_pages('title_li=&depth=4&sort_column=menu_order'); ?> <li><a href="YOUR URL">YOUR LINK NAME</a></li>
It's very simple. Wordpress will scan the contents of all the files in a Wordpress theme to see how it all hangs together. When Wordpress sees the following code:- <?php /* Template Name: TEMPLATE-NAME-GOES-HERE */ ?> ...then it knows it's a page template. So create a file and call it something like, newpagetemplate.php Then upload to your WP template folder Next go to your Page Editor in WP you'll see the file, newpagetemplate.php, click on it and call it what you want. SAve and update. Then check your home page you should see the page you just named on the side bar. If all looks good then go back to your template page via the WP editor again and anything below that php code you can add any HTML file you want (don't forget to use absolute URLs for the images) The new page should now show up on your WP Blog!
First questions first. In order to add a node to your navbar, (add another page there), add a code like this, to the top of your header page <?php $my_page_name = ""; // write your page title here within the quotes // remember that you should use \" instead of ", // if it occurs in your title, within the quotation marks $my_link_text = "" // write the link text here if it is different from the page name if (!$my_link_text ) $my_link_text = $my_page_name; $my_page = get_page_by_title( $page_name ); $my_url = get_permalink( $my_page->ID ); ?> Code (markup): Below is how you can implement it to your navbar <ul> <li><a href="#1">Page 1</a></li> <li><a href="#2">Page 2</a></li> <li><a href="#3">Page 3</a></li> <li><a href="#4">Page 4</a></li> <!-- new entry --> [COLOR="Red"]<li><a href="<?php echo get_permalink( $my_page->ID ); ?>"><?php echo $my_link_text; ?></a></li>[/COLOR] </ul> Code (markup): Personally, I would call it a page only when it is added to the cms. Rest of them (like adding some portfolio.php) would be external pages. However, I can't figure out why would you want to not include this page in the database (or not save it through the admin dashboard) except for if you want it to look totally different from the rest of your site. Hope this works --- the sum of a whole is different from the sum of it s parts