Skip to content

No logout COnfirmation

//========== //NO LOGOUT CONFIRMATION /* add_action('check_admin_referer', 'logout_without_confirm', 10, 2); function logout_without_confirm($action, $result) { if ($action == "log-out" && !isset($_GET['_wpnonce'])) { $redirect_to = isset($_REQUEST['redirect_to']) ? $_REQUEST['redirect_to'] : home_url(); //'/beta/'; $location = str_replace('&', '&', wp_logout_url($redirect_to)); header("Location: $location"); die; } }*/

Mehr Lesen

No Admin Bar for Non Admins

//========== //REMOVE ADMIN BAR FOR NON ADMIN /* add_action('after_setup_theme', 'remove_admin_bar'); function remove_admin_bar() { if (!current_user_can('administrator') && !is_admin()) { show_admin_bar(false); } } */

Mehr Lesen

Split Menu

At first register a new menu location: function register_user_menu() { register_nav_menu('main_menu_right',__( 'Right Menu', 'total' )." (".__( 'Right', 'total' ).")"); } add_action( 'init', 'register_user_menu' ); Then in your child theme directory add a new directory "partials/header" with a "header-menu.php" file in…

Mehr Lesen

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
An den Anfang scrollen