If you are writing a Page, and want to manually link to a specific category, simply insert the appropriate HTML in the body of your page:
If you want links to your categories to be automatically created as part of your templates, look into the
You have to be a bit more specific. Categories are listed in your sidebar (navigation) by using the template tag list_cats or the related wp_list_cats.
What about Pages?
Ok, I’ll try to explain a little bit better:
http://niclas.pigne.net/blog <- I want to link to the category “Tutorials” under “Navigation”. Am I clear enough? 🙂
If it’s possible, I would like to hide Tutorials from the archives to. any tips on doing that?
Maybe I am wrong but my impression is under the Navigation you display your Pages (probably using the wp_list_pages tag + a manual link to homepage). And now you want to insert in this list a link to one of the categories. It would be the same way = manully, as you did with your homepage link.
In the categories list you can choose to exclude one or more categories:
thanks! that solved the problem. I wonder why I never thought of including the link the same way I’m including the home link.
If you want to include a link to a category there, you have several choices:
1) remove the
wp_list_pages()template tag, and hard-code a list of navigation items to which you would like to link.
2) create a new page, “Tutorials”, using a Page Template that presents posts from your Tutorials category as you want.
I’ve got a new problem.
I tried creating a new page, like Skippy told me. And I’ve used the get_posts tags to include the posts from the Tutorial category into the Tutorials page.
This is the code I’ve used
$posts = get_posts('numberposts=3');
foreach($posts as $post) :
<a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
<?php endforeach; ?>
But when I try to run it, wordpress gives me an error saying: “Warning: Invalid argument supplied for foreach() in /***/***/public_html/blog/wp-content/themes/ennbee2/tutorials.php on line 16”
What am I doing wrong?
- The topic ‘Linking to a category’ is closed to new replies.