Skip to content

Cleaning a large posmeta database

To clean a large wp_postmeta table in WordPress, you must identify and delete orphaned or unused metadata left behind by deactivated plugins, imported content, or unused themes. The safest approach involves auditing the database to find high-volume keys, verifying they are no…

Mehr Lesen

WooCommerce: Products with Images first

//============================================================================== //WOOCOMMERCE - ARCHIVES - products with image first function custom_woocommerce_images_first_ordering_args( $q ) { $orderby_value = isset( $_GET['orderby'] ) ? wc_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) ); if ( 'images_first' == $orderby_value ) { $q->get( 'meta_key', '_thumbnail_id'…

Mehr Lesen

WooCommerce: No default Shipping

//WOOCOMMERCE - CHECKOUT - No default shipping function enym_uncheck_default_shipping_method() { WC()->session->set( 'chosen_shipping_methods', null ); wc_enqueue_js( " $( document.body ).one( 'updated_checkout', function() { $('input.shipping_method').prop('checked', false); }); " ); } add_action( 'woocommerce_before_checkout_form', 'enym_uncheck_default_shipping_method' ); add_filter( 'woocommerce_shipping_chosen_method', '__return_null' );

Mehr Lesen

WooCommerce allow Search by SKU

//============================================================================== //WOOCOMMERCE - FIXES - SEARCH - Enable search by SKU function search_by_sku( $search, $query_vars ) { global $wpdb; if(isset($query_vars->query['s']) && !empty($query_vars->query['s'])){ $args = array( 'posts_per_page' => -1, 'post_type' => 'product', 'meta_query' => array( array( 'key' => '_sku', 'value' =>…

Mehr Lesen

Simple JS Inject Inline

add_action( 'wp_footer', function() { ?> <script> jQuery(document).ready(function(){ jQuery('.site-search-toggle.search-dropdown-toggle').click(function () { event.preventDefault(); return false; jQuery(".searchform-submit").trigger( "click" ); //alert('alert'); }); }); </script> <?php }, 99 );

Mehr Lesen

Show Child Terms Shortcode

function enym_child_terms($atts) { // Attributes $atts = shortcode_atts( array( 'post_id' => '', 'taxonomy' => '', ), $atts ); //$terms = wp_get_post_terms( $atts['post_id'], $atts['taxonomy']); //return count($terms); $current_term_id = get_queried_object_id(); //Getting all the info of chilldren of the parent, not grandchildren $termchildren…

Mehr Lesen

Logged In Logged out shortcodes

//logged in shortcode function check_user ($params, $content = null){ //check tha the user is logged in if ( is_user_logged_in() ){ //user is logged in so show the content return do_shortcode($content); } else{ //user is not logged in so hide the…

Mehr Lesen

Typography options

add_filter('wpex_typography_settings', function ($settings) { if (isset($settings['entry_h1'])) { $settings['entry_h1']['target'] = 'h1, .wpex-h1, .vcex-module h1, h1.vcex-heading'; } if (isset($settings['entry_h2'])) { $settings['entry_h2']['target'] = 'h2, .wpex-h2, .vcex-module h2, h2.vcex-heading'; } if (isset($settings['entry_h3'])) { $settings['entry_h3']['target'] = 'h3, .wpex-h3, .vcex-module h3, h3.vcex-heading'; } if (isset($settings['entry_h4'])) {…

Mehr Lesen

Siple Particles Shortcode

function particles_shortcode() { $particles = ' <style> #particles, .particles { overflow: hidden; } #particles canvas, .particles canvas { display: block; width: 1909px; height: 1103px; position: absolute; left: 0; top: 0; z-index: -2; pointer-events: none; } </style> <script async src="https://ga.jspm.io/npm:es-module-shims@1.5.1/dist/es-module-shims.js" crossorigin="anonymous"></script>…

Mehr Lesen

Allow empty menuitems

//ALLOW EMPTY MENUTITLE WITH &nbsp; requires no-underline css add_action('wp_update_nav_menu', 'blank_menu_items'); function blank_menu_items($nav_menu_selected_id) { $navmenudata = json_decode(stripslashes($_POST['nav-menu-data']), true); $k = 0; foreach ((array) $navmenudata as $data) { if ( isset($data['name']) && isset($data['value']) && strpos($data['name'], 'menu-item-title') !== false ) { if (trim($data['value'])…

Mehr Lesen
An den Anfang scrollen