A good strategy to print custom posts (offer) that are checked inside the metabox of a post?

The feature is achieved in this way! function op_register_menu_meta_box() { add_meta_box( ‘op-menu-meta-box-id’, // Metabox ID esc_html__( ‘Custom offers Checklist (select any 2)’, ‘text-domain’ ), //Metabox Title ‘op_render_menu_meta_box’, // Metabox Callback Function ‘listing’ // Place Where this Metbax Should Appear ); } add_action( ‘add_meta_boxes_listing’, ‘op_register_menu_meta_box’ ); //Metabox Hook The callback function! function op_render_menu_meta_box( $post ) { … Read more

Exclude child pages from archive.php

Of course it is possible. All you have to do is to set post_parent argument to 0. function remove_children_from_archive( $query ) { if ( ! is_admin() && $query->is_main_query() && is_post_type_archive(‘my_custom_post_type’) ) { // of course you’ll have to change my_custom_post_type to real slug – probably services $query->set( ‘post_parent’, 0 ); } } add_action( ‘pre_get_posts’, ‘remove_children_from_archive’ … Read more

Create Custom Post Type Permalink Structure

The default behaviour of mysite.com/post-type/ and mysite.com/post-type/post-name/ is what you want it to be, so you don’t need to do anything special there. To have mysite.com/post-type/taxonomy/ as the URL for the taxonomy archive, all you need to do is use ‘post-type/taxonomy’ as the rewrite => slug argument when registering the taxonomy.

get_terms showing all categories instead of the ones assigned to a specific post

There are two functions: get_terms get_terms( string|array $args = array(), array $deprecated = ” ) Which retrieves the terms in a given taxonomy or list of taxonomies. And… get_the_terms get_the_terms( int|object $post, string $taxonomy ) Which retrieves the terms of the taxonomy that are attached to the post. You should use second one in your … Read more

Are there sub-systems in WordPress that would employ data structures beyond CPT that a `get_posts` won’t be able to catch?

Actually if you look closely to the codex, you can see that setting ‘post_type’ argument to any will by default leave out some post types from the query: https://codex.wordpress.org/Class_Reference/WP_Query#Type_Parameters ‘any’ – retrieves any type except revisions and types with ‘exclude_from_search’ set to true. So you can actually register a post type and make it non-public, … Read more