$end_date ) { return false; } // Check if the promotion message has been dismissed. if ( 'canceled' === get_option( 'wppfm_black_friday_promotion_2024_dismissed', 'keep_it_on' ) ) { return false; } wp_localize_script( 'wppfm_notice-handling-script', 'wppfm_notice_ajax', array( 'ajax_url' => admin_url( 'admin-ajax.php') ) ); wp_register_style( 'wp-product-feed-manager-promotion-banner', WPPFM_PLUGIN_URL . '/css/wppfm-promotion-notice.css', '', WPPFM_VERSION_NUM, 'screen' ); wp_enqueue_style( 'wp-product-feed-manager-promotion-banner' ); // Show the sales promotion message. WPPFM_Notice::render_sales_promotion_notice(); return true; } add_action( 'admin_notices', 'wppfm_sales_promotion_notice' ); /** * Adds the plugin product identifier field values to the quick edit form as soon as the quick edit option is opened. Gets triggered by the admin_footer action. */ function wppfm_add_product_identifiers_to_quick_edit_custom_fields() { ?> ' . esc_html( get_post_meta( $post_id, 'wppfm_product_brand', true ) ) . ' '; } add_action( 'manage_product_posts_custom_column', 'wppfm_add_wc_quick_edit_custom_fields_data', 10, 2 ); /** * Checks the wpmarketingrobot server for new blogs and adds them to the blog list that is stored in the wppfm_latest_weblogs option. Gets triggered by the wppfm_daily_event action. * * @return void * @since 3.14.0. */ function wppfm_check_for_new_blogs() { $response = wp_remote_get(WPPFM_EDD_SL_STORE_URL . 'wp-json/wp/v2/posts?per_page=1&type=post&status=publish' ); if ( is_wp_error( $response ) ) { return; } $body = wp_remote_retrieve_body( $response ); $data = json_decode( $body, true ); if ( empty( $data ) || ! is_array( $data ) || ! $data[0]['id'] || ! $data[0]['featured_media'] || ! $data[0]['link'] ) { return; } $latest_post = $data[0]; $id = $latest_post['id']; $date = $latest_post['modified']; $title = $latest_post['title']['rendered']; $featured_image_id = $latest_post['featured_media']; $post_url = $latest_post['link']; $image_response = wp_remote_get( WPPFM_EDD_SL_STORE_URL . 'wp-json/wp/v2/media/' . $featured_image_id ); if ( is_wp_error( $image_response ) ) { return; } $featured_image_url = json_decode( wp_remote_retrieve_body( $image_response ), true )['source_url']; if ( ! $featured_image_url ) { return; } $latest_blog_data = array( 'id' => $id, 'date' => $date, 'title' => $title, 'url' => $post_url, 'image_url' => $featured_image_url, ); wppfm_store_latest_blog( $latest_blog_data ); } add_action( 'wppfm_daily_event', 'wppfm_check_for_new_blogs' );