starise / post-thumbnails
PostThumbnails Class for Wordpress. Enables multiple post thumbnails for post type.
Installs: 118
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 2
Forks: 0
Open Issues: 0
Type:wordpress-plugin
Requires
- php: >=5.4.0
- composer/installers: ~1.0
This package is not auto-updated.
Last update: 2024-12-21 18:40:24 UTC
README
PostThumbnails Class for Wordpress. Enables multiple post thumbnails for post type.
Requirements
- PHP >= 5.4
- WordPress >= 3.5
Quick Start
First, in your theme's functions.php
(or you can create a shim plugin that does this on the wp_loaded
action) register a thumbnail. To do this, create a new PostThumbnails
instance and pass in an array of arguments:
use starise\PostThumbnails as PostThumbnails; new PostThumbnails( [ 'label' => 'Secondary Image', 'id' => 'secondary-image', 'post_type' => ['post'] ] );
The template tag PostThumbnails::the_post_thumbnail
is similar to WordPress' the_post_thumbnail
but it displays your custom thumbnail in a post loop:
<?= PostThumbnails::the_post_thumbnail('secondary-image'); ?>
For more details please check out the wiki