Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Jo Gang
Jo Gang
8,746 Points

Get Post from specific category (Genesis+Bootstrap4)

Hello, I'm new to Genesis and php beginner. :)

I'm using Genesis Framework with bootstrap4 for an educational site. In main page, I added bootstrap modal code (popup). So there're clickable buttons for popups.

My question is when the button's clicked, I'd like to know how to display a ecent post contents on a popup from one category.

I will appreciate it if someone can help me.

In case there are people like me, I'd like to share this link. http://wordpress.stackexchange.com/questions/84417/show-specific-category-posts-on-genesis-framework-home-page

I've researched and tried but still couldn't figure it out. Thanks.

1 Answer

Learn WP_Query and all will be revealed!

You're going to need to learn how to create a page template that fetches blog posts using WP_Query. This sounds complex but is actually super easy. WP_Query is essentially a way of telling WP what posts you want to get, from where, and other conditions you want to meet (i.e. get 5 posts, in alphabetical order, by date modified, by a certain author etc.). It gets v thorough. Read the codex to have an idea:

https://codex.wordpress.org/Class_Reference/WP_Query

If you're a PHP noob, you should be able to learn everything through the PHP for Wordpress course and the associated Wordpress courses without touching the harder PHP stuff. Having said that, learning PHP if you want to understand Wordpress (and you're on Treehouse, so I'm guessing you do!) is an excellent idea too.

Have you attempted the Zac Gordon course where he does this yet? If not, do follow through, especially where he creates a blog page and where he creates and displays custom post types.

There is also a seperate 30minute workshop kicking around Treehouse about WP_Query.

Hope that helps!