how to pull images with no add_theme_support(‘post_thumbnails’)

If you don’t want to modify the theme or add a child theme to handle post thumbnail support, you can do it via a plugin by attaching a callback to the after_setup_theme hook:

<?php
/*
Plugin Name: WPSE Post Thumbnail Support
Plugin URI: 
Description: Adds post thumbnail support to theme.
Version: 0.0.1
Author:
Author URI:
License: GPL2/Creative Commons
*/


add_action( 'after_setup_theme', 'wpse_theme_setup' );
function wpse_theme_setup() {
    /*
     * Enable support for Post Thumbnails on posts and pages.
     */
    add_theme_support( 'post-thumbnails' );
}

Alternatively, you could create your own attachment image upload functionality (personally, I use CMB2 for this) then grab the image by the meta ID and pass it to wp_get_attachment_image().

Leave a Comment