add_action(‘add_meta_boxes’, function() { add_meta_box( ‘custom-logo-metabox’, ‘Custom Logo’, function($post) { // Add a nonce field so we can check for it later wp_nonce_field(‘custom_logo_meta_box’, ‘custom_logo_meta_box_nonce’); // Retrieve the existing value from the database $custom_logo_id = get_post_meta($post->ID, ‘_custom_logo_id’, true); $custom_logo_url = $custom_logo_id ?…Continue reading
/** * Change number of products that are displayed per page (shop page) */ add_filter( ‘loop_shop_per_page’, ‘new_loop_shop_per_page’, 20 ); function new_loop_shop_per_page( $cols ) { // $cols contains the current number of products per page based on the value stored on…Continue reading
// === SCHEMA: define every shortcode, its params, and internal template === $shortcode_schemas = [ ‘faqs’ => [ ‘description’ => ‘Expandable FAQ section.’, ‘parameters’ => [], ‘_internal’ => [ ‘template_id’ => 3676 ], // INTERNAL ONLY ], // [faq faqs='[{“question”:”…”,”answer”:”…”}]’]…Continue reading
// This creates an avater Shortode function bb_logged_in_user_avatar_shortcode($atts) { if (is_user_logged_in()) { $current_user = wp_get_current_user(); $avatar = get_avatar($current_user->ID, 96); // 96 is the size in pixels return $avatar; } else { return ”; } } // This creates an USER…Continue reading
add_post_type_support( ‘page’, ‘excerpt’ );Continue reading
add_action(‘template_redirect’, function () { if (preg_match(‘#^/members/(.+)#’, $_SERVER[‘REQUEST_URI’], $matches)) { wp_redirect(home_url(‘/’ . $matches[1]), 301); exit; } });Continue reading
/** * ============================================================================ * WORDPRESS DYNAMIC DATA FETCHING FUNCTION * ============================================================================ * @author Sumaiya Akter, Anytype Doc: anytype://object?objectId=bafyreidvxgrkcebamky2hxzxazxbe3phrie6ev44zyhjzco7cmhkgovhle&spaceId=bafyreih4bocrmskuomcrks3sjwpnzxpbxvxwgto23vof3umg2fywdqzjmy.31bq39w6q8ru7&cid=bafybeifc55atash7zlqcjd3fv425bkwl7z5zstcxdilct5hstlng73xwci&key=6kKA3QiwnksqLbpcJ4T6UhmQ5BHzgJUfbpn1QLnkv5Lv * @description This function dynamically fetches data from any specified * WordPress database table based on a set of search criteria. It…Continue reading
function rudr_taxonomy_filter( $post_type ){ // let’s decide about post type first if( ‘unifi-custom-menu’ !== $post_type ){ return; } // pass multiple taxonomies as an array of their slugs $taxonomies = array( ‘un-menu-cat’ ); // for every taxonomy we are going…Continue reading
function rd__current_user() { static $u = null; if ($u !== null) { return $u; } $u = wp_get_current_user(); // Core: sets current user if not already set. return $u; } /** [user_first_name] */ function rd_sc_user_first_name() { static $first = null;…Continue reading