Function Reference: geodir_set_post_attachment
Summary
set attachments for all geodir posts.
Package
GeoDirectory
Change Log
Since: 1.0.0
Source File
geodir_set_post_attachment() is located in geodirectory_hooks_actions.php [Line: 1927]
Source Code
function geodir_set_post_attachment() { if (!get_option('geodir_set_post_attachments')) { require_once(ABSPATH . 'wp-admin/includes/image.php'); require_once(ABSPATH . 'wp-admin/includes/file.php'); $all_postypes = geodir_get_posttypes(); foreach($all_postypes as $post_type){ $args = array( 'posts_per_page' => -1, 'post_type' => $post_type, 'post_status' => 'publish'); $posts_array = get_posts($args); if (!empty($posts_array)) { foreach ($posts_array as $post) { geodir_set_wp_featured_image($post->ID); } } } update_option('geodir_set_post_attachments', '1'); } }