Same base slug for CPT post and CPT taxonomy terms
Same base slug for CPT post and CPT taxonomy terms
Same base slug for CPT post and CPT taxonomy terms
Yes, there is a built-in WordPress function you can use to render a list of checkboxes (or simply, checklist) which then allows the user to select multiple terms, and the function is wp_terms_checklist(). However, the function only works for users who have the capability/permission to assign terms to a post, so you’d need to create … Read more
This did it: $products = get_posts(array(‘post_type’ => ‘products’)); $numbers = range(0, 8); shuffle($numbers); $x = 0; foreach($products as $post) : setup_postdata($post); $product = new WP_Query(array(‘p’=>$post->ID,’post_type’=>’products’)); if (!empty($product->posts)) array_splice($posts,$numbers[$x],0,$product->posts); $x++; endforeach; foreach($posts as $post) : setup_postdata($post); …
The add_meta_boxes hooks load in edit-form-advanced.php. Your custom plugin page “test” does not use that file. You need to hook into the “plugin admin page hooks” instead. Secondly, the third parameter of add_meta_box is just the CPT slug, not the page slug you have. Here is what you need to change: add_action(“load-my-cpt_page_my-cpt-slug”, “my_add_metaboxes”); function my_add_metaboxes() … Read more
There is no easy query that will do that (see below). You will need to process your results in PHP to get the sort you are looking for. Something like this: $args = array( ‘posts_per_page’ => 5, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘post_type’ => array(‘post’, ‘book’), ‘post_status’ => ‘publish’ ); $posts = get_posts( $args … Read more
On clicking on the category name the page is redirecting on 404 pge
I have some recommendation maybe could help You and Other for better security and some reason create a plugin for do it and use shortcode or other way for print result in front page don’t use ajax call to the direct php file and use admin_ajax.php which you can find how to use in wp … Read more
You can add this line to the code which registers your Custom Post Type: ‘taxonomies’ => array( ‘category’ ), Or you could add Taxonomies rather than categories: add_action( ‘init’, ‘cpt_type_taxonomy’ ); function cpt_type_taxonomy() { register_taxonomy( ‘portfolio-type’, ‘portfolio’, array( ‘labels’ => array( ‘name’ => _x( ‘Types’, ‘taxonomy general name’, ‘theme’ ), ‘add_new_item’ => __( ‘Add New … Read more
That can be achieved with the hooks edit_form_after_title and edit_form_after_editor and proceed like a meta box. I noticed a “glitch”, though, if you swap Visual/Html in the custom wp_editors and then publish/refresh the page, their state will be the same as the main editor (the post content). Adjust the post type, page in this example. … Read more
(Revised answer) If I understand it properly, try these: Define $the_post for each “property”: <?php $the_post = get_post(); ?> <div class=”property-details”> <h2><?php the_title(); ?></h2> … </div> Then change the drop-down code to: <select name=”propname”> <?php $found = wp_list_filter( $the_query->posts, [ ‘ID’ => $the_post->ID ] ); if ( empty( $found ) ) : ?> <option selected><?php … Read more