Custom Theme Building & Permalinks

The Action Reference may give you some insight into what’s going on when you visit a front-end page in WordPress and help you to understand things a bit better. Actions are events that occur in the process of loading a page, they let you “hook” into the process to run your own code at specific … Read more

Get query result according to merged array

Use orderby post__in $loop = new WP_Query( array( ‘post_type’ => ‘product’, ‘post__in’ => $posts, ‘paged’ => $paged, ‘posts_per_page’ => 5, ‘orderby’ => ‘post__in’ ) ); Remember it is only available from version 3.5

Create a hierarchical loop at predefined markup requirements

I was able to figure it out myself, here is the code: <div id=”fullpage”> <?php //for each category, show 5 posts $cat_args=array( ‘orderby’ => ‘name’, ‘order’ => ‘desc’ ); $categories=get_categories($cat_args); foreach($categories as $category) { $args=array( ‘showposts’ => 5, ‘category__in’ => array($category->term_id), ); $posts=get_posts($args); if ($posts) { echo ‘<section class=”vertical-scrolling” data-anchor=”‘ . $category->name.'”>’; foreach($posts as $post) … Read more