Shortcode plugin for custom content?

Can anybody be recommend a plugin that will let me creat a list of titles and associate custom content (ex,. HTML code) with each title. Then in a post I enter the title using the shortcode plugin and it will spit out the custom content into the rendered post?

Example in plugin GUI:

Title1 | <a href=“blabla” />

Title2 | <a href=“blablabla” />

Example in post:

[title1]

Example in output:

<a href=“blabla” />

Réponses

  • chaudharychaudhary Member

    First, we will show you a quick and fully working example so that you understand how it works. Take a look at this code:

    // Our custom post type function
    function create_posttype() {

    register_post_type( 'movies',
    // CPT Options
        array(
            'labels' => array(
                'name' => __( 'Movies' ),
                'singular_name' => __( 'Movie' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'movies'),
            'show_in_rest' => true,
    
        )
    );
    

    }
    // Hooking up our function to theme setup
    add_action( 'init', 'create_posttype' );
    What this code does is that it registers a post type 'movies' with an array of arguments. These arguments are the options of our custom post type.

Connectez-vous ou Inscrivez-vous pour répondre.