// ✅ Add social sharing buttons under each Word of the Day // ✅ Add social sharing buttons to each Word of the Day function wotd_add_social_sharing_buttons($content) { if (is_singular('wotd')) { // agar custom post type 'wotd' hai $url = urlencode(get_permalink()); $title = urlencode(get_the_title()); $image = wp_get_attachment_url(get_post_thumbnail_id()); $buttons = '

📤 Share this Word!

Facebook Twitter WhatsApp Pinterest LinkedIn
'; return $content . $buttons; } return $content; } add_filter('the_content', 'wotd_add_social_sharing_buttons'); // ✅ Automatically generate featured image from Pixabay (Free) // ✅ Auto image generator for auto-published WOTD add_action('save_post_wotd', 'generate_wotd_image_pixabay', 10, 3); function generate_wotd_image_pixabay($ID, $post, $update) { // Agar post publish nahi hui, to skip if (get_post_status($ID) !== 'publish') return; $word = get_the_title($ID); $api_key = defined('PIXABAY_API_KEY') ? PIXABAY_API_KEY : ''; if (empty($api_key)) return; $url = "https://pixabay.com/api/?key={$api_key}&q=" . urlencode($word) . "&image_type=photo&orientation=square&per_page=3"; $response = wp_remote_get($url); if (is_wp_error($response)) return; $body = json_decode(wp_remote_retrieve_body($response)); if (!empty($body->hits[0]->largeImageURL)) { $image_url = $body->hits[0]->largeImageURL; $image = media_sideload_image($image_url, $ID, $word . ' - Word of the Day', 'id'); set_post_thumbnail($ID, $image); } } // Word of the Day Archive Custom Title + Meta Description add_action('wp_head', function() { if (is_post_type_archive('wotd')) { echo 'Word of the Day | Daily Vocabulary & Meaning'; echo ''; } });