Topic RSS
Final
Since version 1.4.9 the public method fpwCategoryThumbnails::addThumbnailToPost is available to plugins developers in both back and front end. There are three ways to add a post thumbnail to a post:
- manual – assignment of the Featured Image to the post while adding or modifying through admin user interface
- automatic – while the post is being created or modified – Add New Post or Edit Post admin screens
- pressing Apply Mapping button of plugin's settings page
However, there are cases when a post is being created / modified outside of the admin user interface. In such cases the assignment of a thumbnail does not occur. The following example shows how to assign or change post thumbnail in one of this cases.
$myPost = array(
// all neccessary post's elements
);
$post_id = wp_insert_post( $myPost ); // create or modify a post bypassing 'save_post' action
// check if post is ceated / modified and the method exists
if ( $post_id && method_exists( 'fpwCategoryThumbnails', 'addThumbnailToPost' ) ) {
$post = get_post( $post_id );
// thumbnail assignment
fpwCategoryThumbnails::addThumbnailToPost( $post_id, $post );
}
Most Users Ever Online: 8
Currently Online:
1 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Member Stats:
Guest Posters: 5
Members: 1
Moderators: 0
Admins: 1
Forum Stats:
Groups: 1
Forums: 6
Topics: 8
Posts: 13
Newest Members: Frank P., Frank P. Walentynowicz
Administrators: Frank P. Walentynowicz (7)

Log In
Home
Offline


Recent Comments