osteopathglasgow
Member
Posted 2 years ago #
Hi just created a new static front page. I now need to delete te first entry I have on Nav bar. Been through most of the suggestions I can find in forums, but can't seem to find the bit of code i need to delete. tryed deleting a few lines with no change (re-installed them again)
Here's the code for index php. anyone any ideas?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>
<?php bloginfo('name'); ?>
<?php wp_title(); ?>
</title>
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php bloginfo('charset'); ?>" />
<meta name="robots" content="all" />
<!-- leave this for stats please -->
<meta name="generator" content="WordPress <?php bloginfo('version'); ?>" />
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" />
<link rel="alternate" type="application/rss+xml" title="RSS 2.0" href="<?php bloginfo('rss2_url'); ?>" />
<link rel="alternate" type="text/xml" title="RSS .92" href="<?php bloginfo('rss_url'); ?>" />
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" /> <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
<?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>
<?php wp_head(); ?>
<link rel="stylesheet" href="<?php echo get_bloginfo('template_directory'); ?>/style.css" type="text/css" media="screen" />
</head>
<body>
<!-- Begin Container -->
<div id="container">
<!-- Begin Header -->
<div id="header">
<ul id="nav">
<li <?php if ( is_home() || is_category() || is_archive() || is_search() || is_single() || is_date() ) { echo ' class="current_page_item"'; } ?>>
<a href="<?php echo get_settings('home'); ?>">Home</a>
</li>
<?php wp_list_pages('depth=1&title_li='); ?>
</ul>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<div class="bloginfo">
<h1><a href="<?php echo get_option('home'); ?>/"><?php bloginfo('name'); ?></a></h1>
<p><?php bloginfo('description'); ?></p>
</div>
<a href="<?php bloginfo('rss2_url'); ?>" class="rss">subscribe to RSS</a>
<ul id="cat">
<?php wp_list_categories('depth=1&title_li='); ?>
</ul>
</div>
<!-- End Header -->
thanks in advance Dan
osteopathglasgow.co.uk/wordpress
Use the exclude parameter in <?php wp_list_pages('depth=1&title_li='); ?>
http://codex.wordpress.org/Good_Navigation_Links
osteopathglasgow
Member
Posted 2 years ago #
Sorry I didn't/don't understand where in the code to place it
now it reads <?php wp_list_pages('depth=1&title_li='); ?>
should it read `<?php wp_list_pages('exclude depth=1&title_li='); ?>'
or <?php wp_list_pages('exclude=0'); ?> assuming my page is id is 0?
osteopathglasgow
Member
Posted 2 years ago #
hi again
Read both articles. Tried various ways of using exclude. Either nothing happens or I get another level of nav "buttons",can't work that one out. Maybe the theme I'm using. Just spent so much time that I don't want to ditch it!
Hoping not to use a plugin as I find that each time I get a solution (or given one) I understand everything a little bit better.
So If anyone knows what to delete lets try it!
Did you try <?php wp_list_pages('depth=1&title_li=&exclude=0'); ?> (assuming your page id is 0)?
osteopathglasgow
Member
Posted 2 years ago #
just tried it. even tried it with exclude=1 (the id of new static page). no joy :( I know i can delete new static page and nav for it (just undo creating process) so this isn't an issue. It's just the buggering old home page
When you said "static page" I assumed you meant a page that was not generated by WordPress and did not know that the "static page" is the one you want excluded from the nav bar. At this point I'm a little bit unclear about what you are trying to do. If it is a page created within WordPress the exclude parameter should work. If the page was created outside of WordPress I'd be surprised that it would show up in your menu at all.
osteopathglasgow
Member
Posted 2 years ago #
new page was created through admin page -> add new. it was then set as as static front page in setting->reading. No problems with that.
What I have now on top Nav bar at is a HOME "tab" and HOME PAGE 1 "tab".
t
They both direct to same page I just want the HOME "tab" to go.
Ah, ok. The additional home page link is in your code.
<a href="<?php echo get_settings('home'); ?>">Home</a>
Use <a href="<?php echo get_option('home'); ?>/">Home</a> instead. The get_settings() function has been deprecated.
osteopathglasgow
Member
Posted 2 years ago #
thanks to you all zeo and ss_minow.
i deleted the ">Home< after get_settings.
seems to be displaying correctly. going to have a play and see if all navs properly.
thanks again
It's hard to know exactly what you did because the code in your response was not marked as such and the forum ate it, but you can take out this entire string.
<li <?php if ( is_home() || is_category() || is_archive() || is_search() || is_single() || is_date() ) { echo ' class="current_page_item"'; } ?>>
<a href="<?php echo get_settings('home'); ?>">Home</a>
</li>
osteopathglasgow
Member
Posted 2 years ago #
everything seems to be navigating properly. A success.
Now just 2 jobs to do one is removing the "whole" comment bit from some pages. think i know how to do that.
The second is to get the excerpts displayed on the home page to display the same way as the blog page. This one is template specific (I think).
well away for more fun!
going to mark this as resolved now. woohoo
osteopathglasgow
Member
Posted 2 years ago #
for future reference I changed
<a href="<?php echo get_settings('home'); ?>">Home</a>
to
<a href="<?php echo get_settings('home'); ?>"></a>
Just in case anyone needs it in the future.
I'm going to try ss_ "new" suggestion. see how it works and post back before I mark as resolved.
removing the "whole" comment bit from some pages
See the is_page conditional tag.
get the excerpts displayed on the home page to display the same way as the blog page
I haven't seen the site so I don't know what you are seeing but it looks like your home page is set to only show links to categories. If you want to display the actual posts or excerpts, check out the Page Of Posts page template example.
osteopathglasgow
Member
Posted 2 years ago #
using 2 plugins on "site" http://osteopathglasgow.co.uk/wordpress/. inline posts and pjw page excerpts. had to change a bit in index php....
?php the_content(”); ?
… was changed to …
?php the_excerpt(”); ?
and i can now get excerpts from my blog and static pages to display as "posts" on my front page.
If you want to have a look the url is at the top!!!
I didn't see php the_content() in the example you posted above and I don't know what either of those plugins does, but yes that is how to make the page template display the excerpt instead of the content (even w/o the plugins).
p.s. I think the quotation mark that you are showing between the parentheses does not need to be there.