add_action( ‘admin_bar_menu’, function ( $admin_bar ) { // Only show this when editing a post. $screen = get_current_screen(); if ( ! $screen || ‘post’ !== $screen->base ) { return; } $post = get_post(); $post_type_object = get_post_type_object( $post->post_type ); if (…Continue reading
// This code snippet creates an admin page for managing vendor profile claims. // It allows administrators to approve or deny claims, which updates the ownership of vendor posts accordingly. // The Vendor Claims page displays pending claims and provides…Continue reading
function vendor_claim_admin_menu() { add_menu_page( ‘Vendor Claims’, ‘Vendor Claims’, ‘manage_options’, ‘vendor-claims’, ‘vendor_claims_page’, ‘dashicons-businessman’, 30 ); } add_action(‘admin_menu’, ‘vendor_claim_admin_menu’); function vendor_claims_page() { global $wpdb; $claims = $wpdb->get_results(“SELECT post_id, meta_value as user_id FROM {$wpdb->postmeta} WHERE meta_key = ‘pending_claim_by_user’”); echo ‘ Vendor Claims ‘;…Continue reading
/** * Ensure Customer Subscriptions are available in the payment confirmation data. */ add_filter( ‘simpay_payment_confirmation_data’, function( $payment_confirmation_data ) { $subscriptions = \SimplePay\Core\API\Subscriptions\all( array( ‘customer’ => $payment_confirmation_data[‘customer’]->id, ‘limit’ => 1, ‘status’ => ‘all’, ‘expand’ => array( ‘data.latest_invoice’, ‘data.latest_invoice.payment_intent’, ), ), $payment_confirmation_data[‘form’]->get_api_request_args()…Continue reading
function custom_admin_css_for_posts_list() { global $pagenow; // Check if we are on the posts listing page if ($pagenow == ‘edit.php’ && (empty($_GET[‘post_type’]) || $_GET[‘post_type’] == ‘post’)) { wp_register_style(‘custom_wp_admin_css’, false); wp_enqueue_style(‘custom_wp_admin_css’); $custom_css = ” #title { width: 400px !important; /* Adjust the…Continue reading
add_action( ‘elementor/query/vehicles_tools_query’, function( $query ) { // Get the term IDs for ‘vehicles’ and ‘tools’ categories by their slugs $term_ids = get_terms([ ‘taxonomy’ => ‘category’, ‘slug’ => [‘vehicles’, ‘tools’], ‘fields’ => ‘ids’, ‘hide_empty’ => true, ]); if ( !empty($term_ids) &&…Continue reading
add_action( ‘elementor/query/custom_exclude_vehicle_tool_subcats’, function ( $query ) { // Find the term IDs for ‘vehicles’ and ‘tools’ categories. $parent_categories = get_terms([ ‘taxonomy’ => ‘category’, ‘slug’ => [‘vehicles’, ‘tools’], ‘fields’ => ‘ids’, ]); $excluded_subcategories = []; if ( !is_wp_error( $parent_categories ) )…Continue reading
// Add the duplicate link to action list for post_row_actions // for “post” and custom post types add_filter( ‘post_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); // for “page” post type add_filter( ‘page_row_actions’, ‘rd_duplicate_post_link’, 10, 2 ); function rd_duplicate_post_link( $actions, $post ) {…Continue reading