I'm sorry, I speak a little English.

My plugin: ~/wp-content/plugins/examplee/examplee.php

     * Plugin Name: Examplee
    function create_posttype() {
        register_post_type( 'movies',
        // CPT Options
                'labels' => array(
                    'name' => __( 'Movies' ),
                    'singular_name' => __( 'Movie' )
                'public' => true,
                'has_archive' => false,
                'rewrite' => array('slug' => 'movies'),
                'show_in_rest' => true,

    add_action( 'init', 'create_posttype' );

    // I would like my listing code here if ?post_type=movies


MySQL insert movies custom post:

INSERT INTO `wp_posts` (`post_content`, `post_title`, `post_type`) VALUES ('demo content', 'demo title','movies');

I see: https://myexample.tld/?post_type=movies

It works!

I would like special listing if ?post_type=movies page in all themes when coding the examplee.php file only:

<ul><li><h3>demo title</h3><p>demo content</p></li></ul>

How to?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.