Sort CPT by taxonomy AND THEN by custom field
Sort CPT by taxonomy AND THEN by custom field
Sort CPT by taxonomy AND THEN by custom field
display posts, pages and custom post types from another wordpress site
Understanding capabilities parameter in register_post_type()
Figured out a solution that works for the issue I was having. This should be able to place an ‘Ads’ custom post type every 3rd post of ‘Articles’ custom post type. <?php // $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var( ‘paged’ ) : 1; $get_posts = new WP_Query(array( ‘post_type’ => ‘articles’, ‘post_status’ =>’publish’, … Read more
You have to return your formatted array. Change the code like below function get_posttype_list() : array { $pt_list = []; $post_types = get_post_types( array( ‘public’ => true ), ‘objects’ ); foreach( $post_types as $pt ) { $pt_list[ $pt->name ] = $pt->labels->singular_name; } return $pt_list; }
Why isn’t page attributes dropdown not showing up in a custom post type
You can have a different slug for the archive by setting has_archive to a string: register_post_type( ‘whatever’, array( ‘has_archive’ => ‘whatever/results’, ‘rewrite’ => array( ‘slug’ => ‘whatever’, ), // …etc. ) ); I’ve tested that and it seems to do exactly what you needed.
The code you shared is for an action/filter named pre_get_posts. WordPress will run this action before it uses the arguments for WP_Query objects to generate SQL. It is an opportunity for you to modify that queries arguments/parameters. By doing this it will call all the functions attached to that action/filter/event. Is this variable a default … Read more
Instead of showing a 401, why not just add the URL to a robots.txt and the search engine will ignore it from indexing. You could also manually add to the headers a meta robots to noindex the page. You could run this via .htaccess to redirect a page to somewhere else (or show 401), but … Read more
If you don’t want to deal with the coding part that much, you can always take a look on WCK plugin, that allows you to create custom taxonomies, and allow your users to see the information displayed as you want.