WPAdverts thumbnail support
-
Greg, I added thumbnail support for the “advert” post type:
/** Enable the thumbnail support for "advert" post type **/ function add_thumbnail_support_for_adverts() { add_theme_support( 'post-thumbnails', array( 'advert' ) ); } add_action( 'after_setup_theme', 'add_thumbnail_support_for_adverts' );
then added the “advert” post type to the main query (main loop) to display ads together with the default WordPress post type on the home page:
/** Add "advert" post type to the main query **/ add_action( 'pre_get_posts', 'add_advert_post_type_to_query' ); function add_advert_post_type_to_query( $query ) { if ( is_home() && $query->is_main_query() ) $query->set( 'post_type', array( 'post', 'advert' ) ); return $query; }
but ads still are saved without thumbnails in the database (the _thumbnail_id meta_key). Can you suggest how to solve this? I think that the first uploaded image can be set up as a thumbnail.
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘WPAdverts thumbnail support’ is closed to new replies.