I am converting an html template to a WordPress theme. In the WordPress theme development process I'm stuck at dynamic logo carousel. Can anyone tell me how to create a logo carousel dynamically without using a plugin? Maybe by using any method like featured post, an image carousel, etc.
1 Answer
You can create a custom post type for the logos as shown below,
function create_post_type() {
register_post_type( 'logo',
array(
'labels' => array(
'name' => __( 'Logos' ),
'singular_name' => __( 'Logo' ),
'add_new' => __( 'Add New' ),
'add_new_item' => __( 'Add New Logo' ),
'featured_image' => __( 'Add Image' ),
'edit_item' => __( 'Edit Logo' )
),
'public' => true,
'menu_icon' => 'dashicons-images-alt2',
'has_archive' => true,
'rewrite' => array('slug' => 'logo'),
'supports' => array('title','thumbnail'),
)
);
}
add_action( 'init', 'create_post_type' );
Add the above code in your theme's functions.php file.
Then you replace your static logos with post loop.