Get Posts by Custom Fields in WordPress (Part 2)

How to Get Posts by Custom Fields in WordPress – Part 2

In part 1 of this series, we learned about how to get posts by custom fields in WordPress with the WP_Query function. However, if we need to deal with databases, it’s better to find another faster, easier, and more convenient way. That method is joining wp_posts and wp_postmeta tables together, and then querying by SQL. In part 2 of the series “How to get posts by custom fields in WordPress”, we’ll use this way to add the advanced searching feature that allows users to search by keywords in posts / pages titles and custom fields content.

Continue reading “How to Get Posts by Custom Fields in WordPress – Part 2”

How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend

How to Build a Hotel Booking Website Using Meta Box – P2 – Booking Page in Backend

In the first post of this series, we created the page showing all the hotel room’s information. It normally has a button or several call-to-action areas to go to the booking page which allows your customers to make an order. However, ‘cause some businesses have strong direct channels, they want their sales to make booking orders for their customers as well. Along with that, to have you imagine how to create a booking page in the frontend later (which is in the 3rd post), I made this post to show you how to create one in the backend. That is for internal users only.

Continue reading “How to Build a Hotel Booking Website Using Meta Box – P2 – Booking Page in Backend”

Get Post by Custom Fields in WordPress, example in advanced search

Get Posts by Custom Fields in WordPress – Part 1

In the previous articles, we’ve known about what Custom Fields is and the application of custom fields which allows users to add arbitrary information into posts. But what do you do after that? In the recent post, you also learned how to add custom fields programmatically and display them in your theme. But you’ll see a shortcoming if there is no classification and searching. This post will guide you on how to get posts by custom fields in WordPress and we’ll create an interesting application: advanced search.

Continue reading “Get Posts by Custom Fields in WordPress – Part 1”