Back to Top

URL to Post ID for Custom Post Types

29 OPINIONS!

In WordPress, url_to_postid is a magic function that helps you convert certain URLs to IDs. However, it is limited to built-in post types. This tip will show you how to quickly make url_to_postid work with WordPress custom post types.... more

Create Fake Pages in WordPress

Create Fake Pages in WordPress
36 OPINIONS!

People's need is changing everyday, and so is WordPress. From a simple blogging software, WordPress has evolved into a somewhat feature-rich Content Management System. It is, therefore, not a surprise if we, users and developers, always try to do crazy things with WordPress these days, and creating virtual (fake) WordPress pages is simply one of those unusual objectives.

So, what do we need fake pages for anyway? What I find particularly useful about... more

Show latest Posts from each Post Type

Show latest Posts from each Post Type
11 OPINIONS!

On WordPress.org's Support Forum, there are many questions asked regarding the same topic: How should we modify WordPress's main query to have a fancier output, namely latest posts from each category or latest posts from each post type?

WordPress unfortunately does not provide any built-in function to handle these kinds of tasks, and it can be quite inefficient if we query for posts multiple times on one page, especially if you have a... more

Reset Post Data

4 OPINIONS!

When you use query_posts() or create a new WP_Query object to get posts from the database, it is necessary to reset the post data so that other portions of a particular page can display correctly.... more

Using Global Variables in WordPress

Using Global Variables in WordPress
13 OPINIONS!

A global variable, as it name suggests, is simply a type of variable that is available for use within any fraction of your codes. PHP's global variables and all their glory can be used within WordPress to help you eliminate code duplication, and in some situations save you some database queries.

Even though many developers think that using global variable is simply a bad practice, if you use it the right way there... more

Page 1 of 1 1