Remove Downloadable and Virtual Products from Woocommerce

add_filter( ‘product_type_options’, function( $options ) { // remove “Virtual” checkbox if( isset( $options[ ‘virtual’ ] ) ) { unset( $options[ ‘virtual’ ] ); } // remove “Downloadable” checkbox if( isset( $options[ ‘downloadable’ ] ) ) { unset( $options[ ‘downloadable’ ]…Continue reading

Save Options Page Top-Bar Settings to Global Header Section Post

if (!defined(‘ABSPATH’)) exit; define(‘TARGET_POST_ID’, 7183); // Specify the post ID of the layout section that should receive the values add_action(‘acf/save_post’, function ($post_id) { if ($post_id !== ‘options’) { return; } $enabled = get_field(‘enable_header_top-bar’, ‘option’) ? ‘1’ : ”; // specify…Continue reading

Site-Wide Hero Optimisation

/** * Promote the hero image (LCP) site-wide: * – fetchpriority=”high”, loading=”eager” * – remove lazy markers from LiteSpeed/Smush * – inject in * Works on every page using the shared hero structure. */ add_action( ‘wp_head’, function () { ?>Continue reading

Calcula o Progresso de uma Etapa, baseado em suas tarefas

function calcular_valor_do_repeater_acf( $post_id ) { $etapas = ‘etapas’; $tarefas = ‘tarefas’; $checkbox = ‘feito’; $progresso_etapa = ‘progresso_da_etapa’; $progresso_projeto = ‘progresso_do_projeto’; // Check rows exists. if( have_rows($etapas) ): $rows_etapas = 0; $progress_etapas = 0; while( have_rows($etapas) ) : the_row(); // Loop…Continue reading

Allow SVG Files Upload

/** * Allow SVG uploads for administrator users. * * @param array $upload_mimes Allowed mime types. * * @return mixed */ add_filter( ‘upload_mimes’, function ( $upload_mimes ) { // By default, only administrator users are allowed to add SVGs. //…Continue reading