Net Price Display 27/03/2024

function display_custom_prices_table_inside_additional_information_tab() { global $product; if (current_user_can(‘shop_manager’) || current_user_can(‘administrator’)) { if (is_product()) { $table_content = ”; $total_profit = 0; $total_net_price = 0; $total_current_price = 0; $table_content .= “ Profit / Loss Sheet Product SKU Net Price Current Price RRP Price…Continue reading

Net Price Display 27/03/2024

function display_custom_prices_table_inside_additional_information_tab() { global $product; if (current_user_can(‘shop_manager’) || current_user_can(‘administrator’)) { if (is_product()) { $table_content = ”; $total_profit = 0; $total_net_price = 0; $total_current_price = 0; $table_content .= “ Profit / Loss Sheet Product SKU Net Price Current Price RRP Price…Continue reading

Next Day Delivery Timer 27/03/2024

function custom_countdown_timer() { date_default_timezone_set(‘Europe/London’); // Ensure the correct timezone is set // Get current day and time $current_day = date(‘w’); // 0 (for Sunday) through 6 (for Saturday) $current_hour = date(‘G’); $start_countdown = false; // Default state is to not…Continue reading

Change POSTS to NEWS in WP dashboard

// Change POSTS to News in WP dashboard add_action( ‘admin_menu’, ‘rd_change_post_menu_label’ ); add_action( ‘init’, ‘rd_change_post_object_label’ ); function rd_change_post_menu_label() { global $menu; global $submenu; $menu[5][0] = ‘News’; $submenu[‘edit.php’][5][0] = ‘News’; $submenu[‘edit.php’][10][0] = ‘Add News’; $submenu[‘edit.php’][16][0] = ‘News Tags’; echo ”; }…Continue reading

custom_realtime_find_replace

function custom_realtime_find_replace($content) { // Define your replacement rules $rules = [ // Example “SOME_KEY_001” => “SOME_VALUE”, “SOME_KEY_002” => “SOME_VALUE2”, ]; // Loop through the rules and replace content foreach ($rules as $find => $replace) { $content = str_replace($find, $replace, $content);…Continue reading

performance

add_action(‘init’, function () { remove_action(‘wp_head’, ‘wp_resource_hints’, 2, 99); }); /** * Disable emojis */ add_action(‘init’, function () { remove_action(‘wp_head’, ‘print_emoji_detection_script’, 7); remove_action(‘admin_print_scripts’, ‘print_emoji_detection_script’); remove_action(‘wp_print_styles’, ‘print_emoji_styles’); remove_action(‘admin_print_styles’, ‘print_emoji_styles’); remove_filter(‘the_content_feed’, ‘wp_staticize_emoji’); remove_filter(‘comment_text_rss’, ‘wp_staticize_emoji’); remove_filter(‘wp_mail’, ‘wp_staticize_emoji_for_email’); add_filter(‘tiny_mce_plugins’, function ($plugins) { if (is_array($plugins)) {…Continue reading

add_custom_javascript_review_sites

function add_custom_javascript() { // Check if we’re on a single post or page if(is_singular()) { // Get the post ID of the current post or page $post_id = get_the_ID(); // Check if the custom field ‘funnel’ exists and get its…Continue reading

disable_content_title_for_all_posts

function disable_content_title_for_all_posts() { $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => -1, ‘fields’ => ‘ids’, // Only get post IDs to improve performance ); $posts = get_posts($args); foreach ($posts as $post_id) { // Assuming ‘_disable_title’ is the meta key and…Continue reading

Remove users from WP-JSON

add_filter(‘rest_endpoints’, function( $endpoints ) { if ( isset( $endpoints[‘/wp/v2/users’] ) ) { unset( $endpoints[‘/wp/v2/users’] ); } if ( isset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ) ) { unset( $endpoints[‘/wp/v2/users/(?P[\d]+)’] ); } return $endpoints; });Continue reading