Answers for "wordpress is custom post type"

1

wordpress custom post type add post_tag

register_post_type('movies',
        array(
            'labels' => array(
                'name'          =>  'Movies',
                'singular_name' =>  'Movie',
                'menu_name'     =>  'MOVIES',
                'all_items'     =>  'All Movies',
                'add_new'       =>  'Add A Movie',
                'add_new_item'  =>  'Add New Movie'
                ),
            'public'    => true,
            'supports'  => array(
                            'title',
                            'post-formats',
                            ),
            'show_in_admin_bar' =>  true,
            'taxonomies' => array('post_tag'), // add this to your configuration
            )
        );
Posted by: Guest on May-31-2022
1

wordpress custom post type Query

<?php 
    query_posts(array( 
        'post_type' => 'portfolio',
        'showposts' => 10 
    ) );  
?>
<?php while (have_posts()) : the_post(); ?>
        <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
        <p><?php echo get_the_excerpt(); ?></p>
<?php endwhile;?>
Posted by: Guest on June-07-2021

Code answers related to "wordpress is custom post type"

Browse Popular Code Answers by Language