Custom page for creating/editing custom post type

when a shortcode is defined, he has to return HTML output. then to allow the theme to customise data presentation, you can do something like that : add_shortcode(“form_step_2”, function ($attr, $content, $tag) { // preparing data //… // result to display $template_name = “form/step_2”; // search the file wp-content/themes/twentytwenty/my_plugin/form/step_2.php $template = locate_template(“my_plugin/$template_name.php”); // if the … Read more

How to create a Child & Siblings menu for a custom post type?

OK, I think I have cracked it. The below code seems to work well. To be able to use a custom post type I added an argument into the $args array’post_type’ => ‘product’, Is the below OK? <div id=”sub-pages”> <?php global $post; $args = array( ‘post_type’ => ‘product’, ‘child_of’ => get_top_ancestor_id(), ‘title_li’ => ” ); … Read more

Apply a custom Template to a Custom Post Type from within a plugin

Here you are – a plugin that is registering a Custom Post Type (CPT) and pushing template file from the plugin for that particular CPT. <?php /** * Plugin Name: WPSE352898 Template Test * Author: Mayeenul Islam * Author URI: https://mayeenulislam.github.io */ /** * Register My Custom Post Type. */ function wpse352898_register_cpt() { register_post_type(‘mycpt’, array( … Read more