CPTUI with Parent/Child categories – Template Structure
CPTUI with Parent/Child categories – Template Structure
CPTUI with Parent/Child categories – Template Structure
is the page supposed to display single posts?… then according to the WordPress Codex Docs you will have to rename your file from gallery-post.php to single-gallery.php Now if it is just a post-format you will have to register it in your functions.php file and see if that works. I hope it helps.
register_post_type() accepts a parameter capabilities in its arguments. See get_post_type_capabilities() for possible values. you can add these settings in your code while registering the custom post type ‘capabilities’ => array( ‘edit_post’ => ‘update_core’, ‘read_post’ => ‘update_core’, ‘delete_post’ => ‘update_core’, ‘edit_posts’ => ‘update_core’, ‘edit_others_posts’ => ‘update_core’, ‘delete_posts’ => ‘update_core’, ‘publish_posts’ => ‘update_core’, ‘read_private_posts’ => ‘update_core’ ),
No ones was answering so i installed this plugin MetaBox.io and I’ve generated this code below that worsk very vell. function arrivo_metabox( $meta_boxes ) { $prefix = ‘arrivo-‘; $meta_boxes[] = array( ‘id’ => ‘arrivo’, ‘title’ => esc_html__( ‘Data di arrivo in negozio’, ‘porto-child’ ), ‘post_types’ => array( ‘riparazioni’ ), ‘context’ => ‘side’, ‘priority’ => ‘default’, … Read more
As @WebElaine says, you can just change the post type directly in MySQL. Any post meta is mapped purely by post ID, so will all still be attached to the right posts. Custom taxonomy terms should still be attached and if you register a taxonomy with the same internal name as your old theme used … Read more
As Andy said, WordPress will load the correct posts for you. You don’t need a custom query. When you’re viewing a custom post type or taxonomy archive the main loop will already have the correct posts based on the URL. So you don’t need any of this: $taxes = array( ‘libro_de_hadiz’ , ‘asunto’); $terms = … Read more
So I was finally able to find what I needed: $loop2 = new WP_Query([ ‘post_type’ => ‘service’, ‘numberposts’ => -1, ‘meta_key’ => ‘_wpcf_belongs_service-category_id’, ‘toolset_relationships’ => [ ‘role’ => ‘child’, ‘related_to’ => $parent_id, ‘relationship’ => [‘service-category’, ‘service’] ] ]); https://wp-types.com/documentation/customizing-sites-using-php/displaying-child-posts/
Enforce all custom posts have specific custom fields
to test the post type where the image is included, try that : add_filter(“media_send_to_editor”, function ($html, $attachment_id, $attachment) { $image = get_post($attachment_id); $post = get_post($image->post_parent); if (“CUSTOM_POST_TYPE_CODE” === $post->post_type) { } return $html; }, 10, 3);
Managed to get it sorted in the end, needed to add a rewrite rule (see below) if you need full source code then let me know and I will be more than happy to paste it. public static function add_rewrite_rules() { add_rewrite_rule( ‘^([^/]+)/([^/]+)/([^/]+)/([^/]+)/?’, ‘index.php?post_type=products&product_holiday=$matches[1]&_product_countries=$matches[2]&_product_types=$matches[3]&name=$matches[4]’, ‘top’ ); } add_action(‘init’, array( __CLASS__, ‘add_rewrite_rules’) ); Thanks,