Type: php
pixel 1
Save images as WEBP
/** * Convert Uploaded Images to WebP Format * * This snippet converts uploaded images (JPEG, PNG, GIF) to WebP format * automatically in WordPress. Ideal for use in a theme’s functions.php file, * or with plugins like Code Snippets…Continue reading
Change Arabic Currency symbol to the currency short code
/** * change arabic currency symbol to short Currency name for AED, SAR, QAR , BHD , OMR , KWD */ add_filter( ‘woocommerce_currency_symbol’, ‘wc_change_uae_currency_symbol’, 10, 2 ); function wc_change_uae_currency_symbol( $currency_symbol, $currency ) { switch ( $currency ) { case ‘AED’:…Continue reading
PHP [FacetWP]: Query Loop Detection
// Reference URL: https://facetwp.com/help-center/listing-templates/wp-archive-page/ // // This script is used to detect the query loop on the post category pages below and // enables filter functionality via FacetWP facets. // // Applies to Post Categories: // – Real Weddings //…Continue reading
PHP: Insert Post Category Filter (using hooks)
function insert_post_filter () { echo ‘ ‘; // get the current taxonomy term $term = get_queried_object(); the_field(‘post_filters_section’, $term); echo ‘ ‘; echo ‘ ‘; } add_action(‘loop_start’, ‘insert_post_filter’);Continue reading
PHP: Query for Dynamic Creation of GridBuilder Grids for Vendor Taxonomies
// This script is designed to modify the query arguments used by WP Grid Builder // for vendor taxonomy archives, ensuring that only relevant posts are displayed // according to the current URL path. It targets a specific grid layout…Continue reading
PHP [Vendor Detail]: Update Post Term Link from Vendor Detail Page & Pre-filter Vendor Taxonomy
add_filter(‘term_link’, ‘custom_vendor_term_link’, 10, 3); // Vendor Detail Link Enrichment // Ensure that all post terms listed on vendor detail layout link back to their // respective (deep link) term page. function custom_vendor_term_link($url, $term, $taxonomy){ switch ($taxonomy) { case ‘vendor-location’: return…Continue reading
visiontest 971
echo “hello shortcode!!”; $a = 1; echo $a.’‘; echo do_shortcode(“[vision id='{$a}’]”); //echo do_shortcode(‘[vision id=”1″]’);Continue reading
Display Multiple Authors on Course Page
if ( is_singular( ‘sfwd-courses’ ) ) { echo ‘ ‘; echo ‘ Course Faculty ‘; $authors = get_field(‘lead_faculty’); foreach($authors as $author_id) { $user_info = get_userdata($author_id); $username = $user_info->user_login; $first_name = $user_info->first_name; $last_name = $user_info->last_name; $email = $user_info->user_email; $username = $user_info->user_login;…Continue reading