Category foreach Paging

I figured it out! After a lot of research and trial and error, I managed to figure out how to get the paging to work for both versions…my original code and the simplified code update. Original Code Solution: <?php $cat = get_cat_ID(“Photos”); $categories = get_categories(“child_of=$cat”); $limit = 9; $total = count($categories); $pages = ceil($total / … Read more

How can I just show portfolio items from 1 category on portfolio page?

Depending on whether you intend to use this template to display other categories elsewhere, you may need a copy of the Portfolio Template file, named for this category. To select a single category for display, from post type ‘portfolioitems’, modify the following line: $wp_query = new WP_Query(array(‘post_type’ => ‘portfolioitems’,’posts_per_page’ => 50,’paged’=> $paged)); To: $wp_query = … Read more

Wrong category being displayed in URL

just an update: I used the plugin WP Permastructure to solve the issue by adding /%category%/%postname%/ in the “category” section on the bottom of the permalinks settings page (the permalink adds new fields). Not really sure why this works but changing the permalink structure normally does not.

$args Orderby The number

You could use the get_terms_orderby filter: add_filter( ‘get_terms_orderby’, ‘wpse156153_get_terms_orderby’, 10, 3 ); $categories=get_categories($cat_args); remove_filter( ‘get_terms_orderby’, ‘wpse156153_get_terms_orderby’, 10, 3 ); with function wpse156153_get_terms_orderby($orderby, $args, $taxonomies ) { return ‘FIELD(t.term_id, ‘ . $args[‘include’] . ‘)’; }