Software Engineering in Web Development, Backend Services, and More

Search: “wp_query” (Page 13 of 29)

We found 145 results for your search.

What Constitutes Clean Code in WordPress?

[…] stuff I believe that we should aim for. Here’s an example from a project on which I’ve been working: function gm_get_total_goals_for( $user_id ) { $query = new WP_Query( array( ‘post_type’ => ‘goal’, ‘author’ => $user_id ) ); echo $query->found_posts; } // end gm_get_total_goals_for Now when this particular function is called, the line of code […]

Searching with Substrings in WordPress

Let’s say you’re in the process of building some type of search mechanism using WP_Query and you want your users to be able to run the search using part of a string. That is, let’s say that you’re searching Companies (which is a custom post type) and some of the company’s names is “Awesome Code.” The […]

« Older posts Newer posts »

© 2026 Tom McFarlin

Theme by Anders NorenUp ↑