Skip to content

v2.1.0

Choose a tag to compare

@SebKay SebKay released this 30 Jul 09:10
· 12 commits to main since this release

This release includes:

Changes to OOPWP\PostTypes\Post

  • New ::setOption method to set the post thumbnail size and CSS classes.
  • New ::withThumbnail method to get the post thumbnail. This is so the thumbnail can be conditionally loaded to stop it loading whenever you create a new post class.
  • New ::thumbnail method for displaying the thumbnail HTML.

Example of setting, getting and displaying the thumbnail:

use OOPWP\PostTypes\Post;

$post_obj = new Post(get_the_ID());

$post_obj
    ->setOption('thumbnail_size', 'post-thumbnail')
    ->setOption('thumbnail_classes', 'test-1 test-2')
    ->withThumbnail();

echo $post_obj->thumbnail();