Welcome to the Treehouse Community
Looking to learn something new?
Morten Korshavn936 Points
Post snippet for Wordpress!
I wonder if anyone could help me with 2 small problems i'm having in WP.
At my frontpage/landing page in WP i need it to show the 3 latest news fromt the post function. Any snippet of code for that?
Some of my of my other pages at the website, needs to be split into categories. So if you for example visit the "design" page, i'll only need the post from the category design to show up.
Hope someone can help with this small problem.
Zac GordonTreehouse Guest Teacher
First off, you will want to use the WP_Query function for creating a custom loop that only shows the latest three blog posts. Check out this workshop on WP_Query for some more info on specifics.
You can also use this approach for creating custom category listing pages. However, WordPress automatically creates category listing pages for you. Depending on what your URL structure looks like, you should be able to do something like this yoursite.com/category/thecategoryslug and it will automatically generate a page with all of those posts.
In your menu sections in the admin area you can also create links directly to category pages.