Snippets Collections
<!-- Get all tags displayed -->
    <nav class="all-tags">
        <ul>
            <?php
                $tags = get_tags('post_tag'); //taxonomy=post_tag
        
                if ( $tags ) :
                foreach ( $tags as $tag ) : ?>
                    <li class="tags">
                        <a href="<?php echo esc_url( get_tag_link( $tag->term_id ) ); ?>" 							title="<?php echo esc_attr( $tag->name ); ?>">
                        <?php echo esc_html( $tag->name ); ?>
                        </a>
                    </li>
                <?php endforeach; ?>
            <?php endif; ?>
        </ul>
    </nav>
$( ".variations_form" ).on( "woocommerce_variation_select_change", function () {
    // Fires whenever variation selects are changed
} );

$( ".single_variation_wrap" ).on( "show_variation", function ( event, variation ) {
    // Fired when the user selects all the required dropdowns / attributes
    // and a final variation is selected / shown
} );
<?php

if( have_rows('your_group') ): while ( have_rows('your_group') ) : the_row(); 

    if( have_rows('your_repeater') ): while ( have_rows('your_repeater') ) : the_row();       

        echo get_sub_field('repeater_sub_field');

    endwhile; endif;

endwhile; endif;

?>
/**
*   WooCommerce woocommerce_order_item_line_item_html action hook registeration.
*/
add_action('woocommerce_order_item_line_item_html', 'woocommerce_order_item_line_item_html', 1, 3);


/**
* Callback Listener for customised line item functionality in the admin.
*/
function woocommerce_order_item_line_item_html($item_id, $item, $order){
    // Add your custom line item functionality.
    // A good example would be order fulfillment for a line item.
}
add_filter( 'woocommerce_product_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
add_filter( 'woocommerce_product_variation_get_stock_quantity' ,'custom_get_stock_quantity', 10, 2 );
function custom_get_stock_quantity( $value, $product ) {
    $value = 15; // <== Just for testing
    return $value;
}
add_filter( 'woocommerce_checkout_fields', 'alter_woocommerce_checkout_fields' );

function alter_woocommerce_checkout_fields( $fields ) {

  unset( $fields['billing']['billing_company'] ); // remove the option to enter in a company
  unset( $fields['billing']['billing_address_1'] ); // remove the first line of the address
  unset( $fields['billing']['billing_address_2'] ); // remove the second line of the address
  unset( $fields['billing']['billing_city'] ); // remove the billing city
  unset( $fields['billing']['billing_postcode'] ); // remove the ZIP / postal code field
  unset( $fields['billing']['billing_country'] ); // remove the billing country
  unset( $fields['billing']['billing_state'] ); // remove the billing state
  unset( $fields['billing']['billing_phone'] ); // remove the option to enter in a billing phone number
  unset( $fields['shipping']['shipping_first_name'] );

  unset( $fields['shipping']['shipping_last_name'] );

  unset( $fields['shipping']['shipping_company'] );

  unset( $fields['shipping']['shipping_address_1'] );

  unset( $fields['shipping']['shipping_address_2'] );

  unset( $fields['shipping']['shipping_city'] );

  unset( $fields['shipping']['shipping_postcode'] );

  unset( $fields['shipping']['shipping_country'] );

  unset( $fields['shipping']['shipping_state'] );

  unset( $fields['account']['account_username'] ); // removing this or the two fields below would prevent users from creating an account, which you can do via normal WordPress + Woocommerce capabilities anyway
  unset( $fields['account']['account_password'] );

  unset( $fields['account']['account_password-2'] );

  unset( $fields['order']['order_comments'] ); // removes the order comments / notes field

  return $fields;
}

;
// add a custom Coming Soon page

add_action( 'template_redirect', 'my_custom_coming_soon' );

function my_custom_coming_soon() {

    if( !is_user_logged_in() && !is_page( 'coming-soon' ) ){

        wp_redirect( site_url( 'coming-soon' ) );

        exit();

    }

}


// To disable the coming soon page, just comment out this line by adding // at the start
//add_action( 'template_redirect', 'my_custom_coming_soon' );
Welcome to your new site! Remember Cousett @ Techie Mamma is here to support you.

Need help with your website? Contact <a href="mailto:hellotechiemamma@gmail.com">Techie Mamma</a>!

<a href="http://techiemamma.com">Visit my site</a> for tutorials and all things WordPress, Tech and Mom. Visit the built-in videos for custom videos and basics of WordPress!

Have a new issue or ticket? <a href="https://techiemamma.com/ongoing-support-15-minute-task/" target="_blank" rel="noopener">Submit it and we will get on it right away!</a>
<?php
add_action('admin_init', function () {
    // Redirect any user trying to access comments page
    global $pagenow;
    
    if ($pagenow === 'edit-comments.php') {
        wp_redirect(admin_url());
        exit;
    }
    // Remove comments metabox from dashboard
    remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
    // Disable support for comments and trackbacks in post types
    foreach (get_post_types() as $post_type) {
        if (post_type_supports($post_type, 'comments')) {
            remove_post_type_support($post_type, 'comments');
            remove_post_type_support($post_type, 'trackbacks');
        }
    }
});
// Close comments on the front-end
add_filter('comments_open', '__return_false', 20, 2);
add_filter('pings_open', '__return_false', 20, 2);
// Hide existing comments
add_filter('comments_array', '__return_empty_array', 10, 2);
// Remove comments page in menu
add_action('admin_menu', function () {
    remove_menu_page('edit-comments.php');
});
// Remove comments links from admin bar
add_action('init', function () {
    if (is_admin_bar_showing()) {
        remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
    }
});
 Save
add_filter( 'mpcs_classroom_style_handles', function( $allowed_handles ) {
  $allowed_handles[] = 'elementor-icons';
  $allowed_handles[] = 'elementor-frontend';
  $allowed_handles[] = 'elementor-post-' . get_the_ID();
  $allowed_handles[] = 'elementor-pro';
  $allowed_handles[] = 'elementor-gallery';
  $allowed_handles[] = 'elementor-icons-fa-solid';
  $allowed_handles[] = 'elementor-icons-fa-brands';
  $allowed_handles[] = 'elementor-icons-fa-regular';
  $allowed_handles[] = 'prismjs_style';
  $allowed_handles[] = 'editor-preview';
  $allowed_handles[] = 'pro-editor-preview';
  $allowed_handles[] = 'flatpickr';
  $allowed_handles[] = 'select2';
  $allowed_handles[] = 'elementor-select2';
  $allowed_handles[] = 'elementor-pro-admin';
  
  return $allowed_handles;
});
/*-----------------------------------------------------------------------------------*/
/*  ACF
/*-----------------------------------------------------------------------------------*/

add_filter('acf/settings/show_admin', '__return_false');
<div class="posts">
            <h2 class="mb-40">
                Recommended Powerlister
            </h2>

            <?php

            $query_args = array(
                'post_type' => 'post',
                'posts_per_page' => 4,
                'meta_key'        => 'show_in_recommended',
                'meta_value'    => '1',
                'orderby'     => 'modified',
                'order'       => 'DESC',
            );

            // The Query
            $the_query = new WP_Query($query_args);

            // The Loop
            if ($the_query->have_posts()) {
                while ($the_query->have_posts()) {

                    $the_query->the_post();
                    $recommended = get_field('show_in_recommended', get_the_ID());



                    $photo = get_field('photo', get_the_ID());
                    $company = get_field('company', get_the_ID());

            ?>

                    <div class="card" style="text-align:left;padding: 0px;width: 100%; margin-left: 4px;">
                        <img src="<?php echo esc_url($photo['url']); ?>" class="card-img-top" alt="...">
                        <div class="card-body">
                            <h2 class="card-title"> <?php the_title(); ?></h2>
                            <p style="font-size: 14px;margin-bottom:0;font-weight: 300;"><?php echo $company; ?></p>
                            <p class="card-text" style="color:#AFAFAF;margin-bottom:0;"><?php echo get_the_date(); ?></p>
                            <a href="<?php the_permalink(); ?>"><img src="<?php echo get_template_directory_uri(); ?>/images/arow.png" alt=""></a>
                        </div>
                    </div>
                    <hr>

            <?php

                }
                /* Restore original Post Data */
                wp_reset_postdata();
            } else {
                // no posts found
            }

            ?>



        </div>
<?php

// get the value of image_advanced type of custom field for the current taxonomy term 
$clients_gallery = rwmb_meta( 'clients_gallery', ['object_type' => 'term'], get_queried_object_id() );
// Allow SVG
function allow_svg($mimes)
{
    $mimes['svg'] = 'image/svg+xml';
    $mimes['svgz'] = 'image/svg+xml';
    return $mimes;
}
add_filter('upload_mimes', 'allow_svg');

function fix_mime_type_svg($data = null, $file = null, $filename = null, $mimes = null)
{
    $ext = isset($data['ext']) ? $data['ext'] : '';
    if (strlen($ext) < 1) {
        $exploded=explode('.', $filename);
        $ext=strtolower(end($exploded));
    }
    if ($ext==='svg') {
        $data['type']='image/svg+xml' ;
        $data['ext']='svg' ;
    } elseif ($ext==='svgz') {
        $data['type']='image/svg+xml' ;
        $data['ext']='svgz' ;
    }
    return $data;
}
add_filter('wp_check_filetype_and_ext', 'fix_mime_type_svg', 75, 4);

function fix_svg() {
  echo '<style type="text/css">
        .attachment-266x266, .thumbnail img {
             width: 100% !important;
             height: auto !important;
        }
        </style>';
}
add_action( 'admin_head', 'fix_svg' );
$catlar = get_the_category($ids);
$yayinevi = get_the_terms($ids,"yayinevi");

join(', ', wp_list_pluck($catlar, 'name'));
wp_enqueue_style( 'flickcore', '/wp-content/uploads/flickity/flickity.css' );

wp_enqueue_script( 'flickjs', '/wp-content/uploads/flickity/flickity.pkgd.min.js',array( 'jquery' ),'2.2.1',true);
<?php if( current_user_can('editor') || current_user_can('administrator') ) {  ?>
    // Stuff here for administrators or editors
<?php } ?>
  
  
// If you want to check more than two roles, you can check if the roles of the current user is inside an array of roles, something like:
$user = wp_get_current_user();
$allowed_roles = array('editor', 'administrator', 'author');
<?php if( array_intersect($allowed_roles, $user->roles ) ) {  ?>
   // Stuff here for allowed roles
<?php } ?>
sudo lsof -i:80; sudo lsof -tnP -i:80 | xargs -n 1 ps -p
kill <PID target>
<?php
/**
 * IMPORTANT!!!
 * Before anything else, make sure that you created a custom field for category and has a field called 'custom_order'
 * Then on each catogory, fill out the custom_order field.
 */

/**
* Separate file
* Add a $is_oos_last variable before the woof shortcode then set it to false after the shortcode
*/
?>

<?php $is_oos_last = true; ?>
 <?php echo do_shortcode( '[woof_products per_page="12" columns="3" is_ajax="1"]' ); ?>
<?php $is_oos_last = false; ?>

<?php
/**
* functions.php
* Modify the query to push out of stock at the bottom of the list
*/
add_filter('posts_clauses', 'tbd_order_by_stock_status', 9999);
function tbd_order_by_stock_status($posts_clauses)
{
    global $wpdb;
    global $is_oos_last;

    if ($is_oos_last == 1 || $_GET['is_oos_last'] == 1 || is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() )) {
        $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
        $posts_clauses['join'] .= " INNER JOIN {$wpdb->prefix}term_relationships term_rel ON {$wpdb->posts}.ID = term_rel.object_id INNER JOIN {$wpdb->prefix}termmeta termmeta1 ON termmeta1.term_id=term_rel.term_taxonomy_id ";
        $posts_clauses['orderby'] = " termmeta1.meta_value ASC, istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
        $posts_clauses['where'] = " AND term_rel.term_taxonomy_id IN (SELECT term_id FROM {$wpdb->prefix}term_taxonomy WHERE taxonomy='product_cat') AND termmeta1.meta_key = 'custom_order' AND istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
    }
    return $posts_clauses;
}
add_filter('woof_draw_products_get_args', 'tbd_woof_draw_products_get_args', 9999 );
function tbd_woof_draw_products_get_args( $args ) {
    $args['is_oos_last'] = 1;
    return $args;
}
<?php

/**
* Separate file
* Add a $is_oos_last variable before the woof shortcode then set it to false after the shortcode
*/
?>

<?php $is_oos_last = true; ?>
 <?php echo do_shortcode( '[woof_products per_page="12" columns="3" is_ajax="1"]' ); ?>
<?php $is_oos_last = false; ?>

<?php


/**
* functions.php
* Modify the query to push out of stock at the bottom of the list
*/
add_filter('posts_clauses', 'tbd_order_by_stock_status', 9999);
function tbd_order_by_stock_status($posts_clauses)
{
    global $wpdb;
    global $is_oos_last;

    if ($is_oos_last == 1 || $_GET['is_oos_last'] == 1 || is_woocommerce() && (is_shop() || is_product_category() || is_product_tag() )) {
        $posts_clauses['join'] .= " INNER JOIN $wpdb->postmeta istockstatus ON ($wpdb->posts.ID = istockstatus.post_id) ";
        $posts_clauses['orderby'] = " istockstatus.meta_value ASC, " . $posts_clauses['orderby'];
        $posts_clauses['where'] = " istockstatus.meta_key = '_stock_status' AND istockstatus.meta_value <> '' " . $posts_clauses['where'];
    }
    return $posts_clauses;
}
add_filter('woof_draw_products_get_args', 'tbd_woof_draw_products_get_args', 9999 );
function tbd_woof_draw_products_get_args( $args ) {
    $args['is_oos_last'] = 1;
    return $args;
}
function b2b_redirect_if_product_is_not_for_user() {
    if ( is_product() ) {
        $allowed_user = get_post_meta( get_the_ID(), '_allowed_user', true );
        if ( $allowed_user != get_current_user_id() ) {
            wp_redirect( site_url( '/shop' ), 301 );
        }
    }
}

add_action('template_redirect', 'b2b_redirect_if_product_is_not_for_user');
<?php

add_filter( 'woocommerce_product_query_meta_query', 'show_only_products_with_specific_metakey', 10, 2 );
function show_only_products_with_specific_metakey( $meta_query, $query ) {
    // Only on shop pages
    if( ! is_shop() ) return $meta_query;

    $meta_query[] = array(
        'key'     => '_allowed_user',
        'value'   => get_current_user_id(),
    );
    return $meta_query;
}
<?php

$args = array(
  'role'    => 'customer',
  'orderby' => 'user_nicename',   
  'order'   => 'ASC'
);
$users = get_users( $args );

echo '<ul>';
foreach ( $users as $user ) {
	echo '<li>' . esc_html( $user->display_name ) . '[' . esc_html( $user->user_email ) . ']</li>';
}
echo '</ul>';
<?php

add_filter( 'woocommerce_product_data_tabs', 'b2b_add_user_product_per_user_tab' ); 
function b2b_add_user_product_per_user_tab( $tabs ) {
    $tabs['product-per-user'] = array( 
        'label' => __( 'Assign User', 'woocommerce' ), 
        'target' => 'product_per_user', 
        'class' => array( 'show_if_simple', 'show_if_variable' ), 
    ); 
    return $tabs; 
}

add_action('woocommerce_product_data_panels', 'b2b_product_per_user_panel');
function b2b_product_per_user_panel() {
    global $post;
    // Note the 'id' attribute needs to match the 'target' parameter set above
	?>
    <div id='product_per_user' class='panel woocommerce_options_panel'>
        <?php $redeemable_stores = (array) get_post_meta( $post->ID, '_redeem_in_stores', true );?>
        <p class='form-field _redeem_in_stores'>
            <label for='_redeem_in_stores'><?php _e( 'Redeemable in stores', 'woocommerce' ); ?></label>
            <select name='_redeem_in_stores[]' class='wc-enhanced-select' multiple='multiple' style='width: 80%;'>
                <option <?php selected( in_array( 'AL', $redeemable_stores ) ); ?> value='AL'>Alabama</option>
                <option <?php selected( in_array( 'NY', $redeemable_stores ) ); ?> value='NY'>New York</option>
                <option <?php selected( in_array( 'TX', $redeemable_stores ) ); ?> value='TX'>Texas</option>
                <option <?php selected( in_array( 'WY', $redeemable_stores ) ); ?> value='WY'>Wyoming</option>
            </select>
            <img class='help_tip' data-tip="<?php _e( 'Select the stores where this gift card is redeemable.', 'woocommerce' ); ?>" src='<?php echo esc_url( WC()->plugin_url() ); ?>/assets/images/help.png' height='16' width='16'>
        </p>
    </div>
    <?php
}

/**
 * Save the custom fields.
 */
function save_product_per_user_field( $post_id ) {
	if ( isset( $_POST['_redeem_in_stores'] ) ) :
		update_post_meta( $post_id, '_redeem_in_stores', (array) $_POST['_redeem_in_stores'] );
	endif;
}
add_action( 'woocommerce_process_product_meta_simple', 'save_product_per_user_field' );
add_action( 'woocommerce_process_product_meta_variable', 'save_product_per_user_field' );
wp_register_script( 'jQuery', 'https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js', null, null, true );
wp_enqueue_script('jQuery');
wp_register_style( 'Font_Awesome', 'https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css' );
wp_enqueue_style('Font_Awesome');
/**
* Usage [gift_registry_search_form]
*/
add_shortcode( 'gift_registry_search_form', 'gift_registry_search_form' );
function gift_registry_search_form( $atts )
{
    ob_start();
    ?>
        <div class="gift-registry-search-form">
            <h1>Find a Gift Registry</h1>
            <input type="text" name="gift_registry_first_name" id="gift_registry_first_name" placeholder="Search by first name" />
            <input type="text" name="gift_registry_last_name" id="gift_registry_last_name" placeholder="Search by last name" />
            <input type="text" name="gift_registry_email" id="gift_registry_email" placeholder="Search by email" />
            <button class="search-registry-button">Search</button>
        </div>
    <?php
    $output = ob_get_contents();
    ob_end_clean();

    return $output;
}
<?php

add_action( 'init', 'overrides', 1 );

public function overrides()
{
    global $wp_filter;
    
    // get all callbacks from the hook 'woocommerce_account_gift_registry_endpoint' with a priority of 10
    foreach ($wp_filter['woocommerce_account_gift_registry_endpoint']->callbacks[10] as $callback_function => $registration ) {
    	// check if the callback function contains the hooked method class
        if ( strpos( $callback_function, 'addify_gift_registry_endpoint_content', 32) !== false) {
            remove_action( 'woocommerce_account_gift_registry_endpoint', $callback_function, 10 );
            
            // override the default function of the hook to the function 'my_custom_func'
            add_action( 'woocommerce_account_gift_registry_endpoint', 'my_custom_func', 10 );
           	// re-route which hook should the callback function run
            add_action( 'woocommerce_account_another_endpoint', $callback_function, 10 );
        }
    }
}
@media (max-width: 980px) {
.forceRowOrder {
	display: flex;
  flex-wrap: wrap;
}

.Order1 {
	order: 1;
	margin-bottom: 30px !important;
}

.Order2 {
	order: 2;
	margin-bottom: 0px !important;
}
}
<?php
 /*
 Plugin Name: Disable Smart Quotes
 Plugin URI:
 Description: Disable curly smart quotes in post content, comment and title.
 Version: 1.0
 Author: WebNots
 Author URI: https://www.webnots.com
 */
 remove_filter('the_content', 'wptexturize');
 remove_filter('comment_text', 'wptexturize');
 remove_filter('the_title', 'wptexturize');
 ?>
define('FS_METHOD', 'direct');
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', true);
<?php $recent = new WP_Query("posts_per_page=-1&cat=26&orderby=title&order=ASC");
                    while ($recent->have_posts()) : $recent->the_post(); ?>
                        <div class="col-sm-5 col-md-3">
                            <div class="thumbnail" style="text-align:center;">
                                <a class="logosSocios" target="_blank" href="<?php the_field('enlace') ?>"><span><?php the_post_thumbnail('', ['class' => 'img-responsive center-block']); ?></span></a>
                                <div class="caption">
                                    <!-- <h4><?php the_title(); ?></h4> -->
                                    <a class="btn btn-primary btn-socios" style="color: white; border-color: #fff;" href="<?php the_field('enlace') ?>" target="_blank" rel="noopener noreferrer"><?php the_title(); ?></a>
                                </div>
                            </div>
                        </div>
                    <?php endwhile;
                    wp_reset_query(); ?>
<!--la ruta absoluta-->
<img src="<?php echo get_bloginfo('wpurl');?>/wp-content/themes/temacreado/img/w.logo.png" alt="">
<!--
<?php echo get_bloginfo('wpurl');?> nos da la ruta de: http://localhost/cliente/  la ruta del archivo que tiene todo el wordpress dentro.
-->   
  
<!--La ruta relativa-->
<img src="wp-content/themes/temacreado/img/w.logo.png" alt="">
<!--
solo es la ruta relativa que es segun la ubicación del archivo
pero como los dos archivos se crean con page.php solo la portada es direccionada adecuadamente con esa direción relativa. lo que las paginas(no portada)  no lo reconocen; por eso la nececidad de dar la pocición absoluta.
-->

  <!-- Nos dimos cuenta que -->
  
/* Make Elementor elements expand to fit the full available width - due to how EL puts padding
all the way round columns */
.elementor-section-boxed .elementor-column-gap-default > .elementor-row {
    width: calc(100% + 20px);
    margin-left: -10px;
    margin-right: -10px;
}
.elementor-section-boxed .elementor-column-gap-narrow > .elementor-row {
    width: calc(100% + 10px);
    margin-left: -5px;
    margin-right: -5px;
}
.elementor-section-boxed .elementor-column-gap-extended > .elementor-row {
    width: calc(100% + 30px);
    margin-left: -15px;
    margin-right: -15px;
}
.elementor-section-boxed .elementor-column-gap-wide > .elementor-row {
    width: calc(100% + 40px);
    margin-left: -20px;
    margin-right: -20px;
}
.elementor-section-boxed .elementor-column-gap-wider > .elementor-row {
    width: calc(100% + 60px);
    margin-left: -30px;
    margin-right: -30px;
}
if ( ! function_exists( 'is_shop' ) ) :
    function is_shop() {
        //your codes goes here. 
    }
endif; 
UPDATE wp_options SET option_value = replace(option_value, 'oldurl.com', 'newurl.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'oldurl.com','newurl.com');
UPDATE wp_posts SET post_content = replace(post_content, 'oldurl.com', 'newurl.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'oldurl.com','newurl.com');
/* No-index posts older than 90 days if in PR custom post type */

function noindexOldPRs() {
	$url = 'http://' . $_SERVER[ 'HTTP_HOST' ] . $_SERVER[ 'REQUEST_URI' ];
	$current_post_id = url_to_postid( $url );
	
	$publishdate = get_the_time('Y-m-d', $current_post_id);
	$posttype = get_post_type ($current_post_id);
	
	if ($posttype == "pr") {
		$ninetydaysago = date("Y-m-d", strtotime("-90 days"));
		if($publishdate < $ninetydaysago) {
			echo '<meta name="robots" content="noindex">';
		}
	} elseif (has_tag('nonnews', $current_post_id)) {
		echo '<meta name="Googlebot-News" content="noindex, nofollow">';
	}
	
	//add noindex/nofollow for google news bot
	// get tags
	// if a tag includes nonnews
	// then add
	// <meta name="Googlebot-News" content="noindex, nofollow">

}
add_action('wp_head', 'noindexOldPRs');
.wpcf7 input,
.wpcf7 textarea,
.wpcf7 input[type="submit"] {
transition: 0.3s ease-in-out all
}

.wpcf7 input:not([type="submit"]),
.wpcf7 textarea {
width: 100%;
}

.wpcf7 input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]),
.wpcf7 textarea {
border-width: 0 0 2px;
border-color: #41506DFF;
border-style: solid;
background-color: #FFFFFFFF;
padding: 8px;
color: #3F3F3F;
margin-bottom:20px;
}

.wpcf7 input:not([type=radio]):not([type=checkbox]):not([type=submit]):not([type=button]):not([type=image]):not([type=file]):focus,
.wpcf7 textarea:focus {
border-width: 0 0 2px;
border-color: #41506D;
border-style: none;
background-color: #FFFFFFFF;
box-shadow: 0px 0px 13px #00000024;
}
.wpcf7 label {
font-size:16px;
font-weight:600;
color:#41506D;
}
.wpcf7 input::placeholder,
.wpcf7 textarea::placeholder {
font-size:16px;
font-weight:600;
color:#000000;
}
.wpcf7 input[type="submit"] {
font-size:16px;
font-weight:600;
color:#FFFFFF;
background-color:#41506D;
padding:16px 40px;
height: auto;
display: block;
width: 100%;
max-width: 100%;
border-radius: 30px;
}
.wpcf7 input[type="submit"]:hover {
color:#FFFFFFFF;
background-color:#6A82A6FF;
box-shadow: 0px 12px 33px #00000055;
border-radius: 30px;
}
## EXPIRES HEADER CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType image/svg "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType application/javascript "access 1 month"
ExpiresByType application/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 2 days"
</IfModule>
## EXPIRES HEADER CACHING ##
remove_theme_support(  'block-templates' );
// hoja css
wp_enqueue_style( 'tema_fray_framework', get_template_directory_uri().'/css/fray.css',array(),time());
// hoja Js
wp_enqueue_script( 'tema_fray_js', get_template_directory_uri() . '/js/misfunciones.js', array(),time(),true);

// true: carga el js en el footer
// false(por defecto): carga el js en el head
// Nota: "las hojas css(estilo), se deben cargar en el head(defaul o false)" 
wp search-replace '<script async\s*.*>\s*.*<\/script>' '' wp_posts --regex --allow-root
if ( ! defined( 'WPINC' ) ) {
	die;
}

add_action( 'wp_enqueue_scripts', 'custom_enqueue_files' );
/**
 * Loads <list assets here>.
 */
function custom_enqueue_files() {
	// if this is not the front page, abort.
	// if ( ! is_front_page() ) {
	// 	return;
	// }

	// loads a CSS file in the head.
	// wp_enqueue_style( 'highlightjs-css', plugin_dir_url( __FILE__ ) . 'assets/css/style.css' );

	/**
	 * loads JS files in the footer.
	 */
	// wp_enqueue_script( 'highlightjs', plugin_dir_url( __FILE__ ) . 'assets/js/highlight.pack.js', '', '9.9.0', true );

	// wp_enqueue_script( 'highlightjs-init', plugin_dir_url( __FILE__ ) . 'assets/js/highlight-init.js', '', '1.0.0', true );
}
jQuery(document).ready(function($) {
    // $() will work as an alias for jQuery() inside of this function
    [ your code goes here ]
} );
//set up load.php inside /wp-content/mu-plugins, then add:
require(WPMU_PLUGIN_DIR . '/myplugin/myplugin.php');

//OR –– use below for multiple mu-plugins inside a subdirectory
//
// Opens the must-use plugins directory
$wpmu_plugin_dir = opendir(WPMU_PLUGIN_DIR);

// Lists all the entries in this directory
while (false !== ($entry = readdir($wpmu_plugin_dir))) {
$path = WPMU_PLUGIN_DIR . '/' . $entry;

// Is the current entry a subdirectory?
if ($entry != '.' && $entry != '..' && is_dir($path)) {
// Includes the corresponding plugin
require($path . '/' . $entry . '.php');
}
}

// Closes the directory
closedir($wpmu_plugin_dir);
<?php
/**
 * Gutenberg Examples Stylesheets
 */
 
function gutenberg_examples_02_register_block() {
    wp_register_script(
        'gutenberg-examples-02',
        plugins_url( 'block.js', __FILE__ ),
        array( 'wp-blocks', 'wp-element' ),
        filemtime( plugin_dir_path( __FILE__ ) . 'block.js' )
    );
 
    wp_register_style(
        'gutenberg-examples-02-editor',
        plugins_url( 'editor.css', __FILE__ ),
        array( 'wp-edit-blocks' ),
        filemtime( plugin_dir_path( __FILE__ ) . 'editor.css' )
    );
 
    wp_register_style(
        'gutenberg-examples-02',
        plugins_url( 'style.css', __FILE__ ),
        array( ),
        filemtime( plugin_dir_path( __FILE__ ) . 'style.css' )
    );
 
    // Allow inlining small stylesheets on the frontend if possible.
    wp_style_add_data( 'gutenberg-examples-02', 'path', dirname( __FILE__ ) . '/style.css' );
 
    register_block_type( 'gutenberg-examples/example-02-stylesheets', array(
        'api_version' => 2,
        'style' => 'gutenberg-examples-02',
        'editor_style' => 'gutenberg-examples-02-editor',
        'editor_script' => 'gutenberg-examples-02',
    ) );
}
add_action( 'init', 'gutenberg_examples_02_register_block' );
$ npx @wordpress/create-block [options] [slug]
.oxygen-body{
  /* Full width styling for Oxygen Gutenberg blocks and Gutenberg images*/
  width:100vw;
  overflow-x:hidden;
}

.alignfull {
    margin-left  : calc( -100vw / 2 + 100% / 2 );
    margin-right : calc( -100vw / 2 + 100% / 2 );
    max-width    : 100vw;
}
//disable post revisions
//define('WP_POST_REVISIONS', false );

//limit post revisions
define('WP_POST_REVISIONS', 3);

//enable debug log
//define( 'WP_DEBUG_LOG', true );

//output debug log
//define( 'WP_DEBUG_DISPLAY', true );
// Place in wp-config
// removing the edit_themes, edit_plugins, and edit_files capabilities for all users
define('DISALLOW_FILE_EDIT', true);

// disable theme updates and new plugins 
// define('DISALLOW_FILE_MODS', true);
<?php

/**
 * Add required plugins to WDS_Required_Plugins.
 *
 * @param  array $required Array of required plugins in `plugin_dir/plugin_file.php` form.
 *
 * @return array           Modified array of required plugins.
 */
function wds_required_plugins_add( $required ) {

	$required = array_merge( $required, array(
		'jetpack/jetpack.php',
		'sample-plugin/sample-plugin.php',
	) );

	return $required;
}
add_filter( 'wds_required_plugins', 'wds_required_plugins_add' );

// for network activated plugins
// add_filter( 'wds_network_required_plugins', 'wds_required_plugins_add' );


/**
 * Modify the required-plugin label.
 *
 * @param  string  $label Label markup.
 *
 * @return string         (modified) label markup.
 */
function change_wds_required_plugins_text( $label ) {

	$label_text = __( 'Required Plugin for ACME', 'acme-prefix' );
	$label = sprintf( '<span style="color: #888">%s</span>', $label_text );

	return $label;
}
add_filter( 'wds_required_plugins_text', 'change_wds_required_plugins_text' );

// To hide required plugins
// add_filter( 'wds_required_plugins_remove_from_list', '__return_true' );

// Add custom dashboard logo
add_action('admin_head', 'my_custom_logo');
  
function my_custom_logo() {
echo '
<style type="text/css">
#header-logo { background-image: url('.get_bloginfo('template_directory').'/img/logo.jpg) !important; }
</style>
';
}
/*
 * Function for post duplication. Dups appear as drafts. User is redirected to the edit screen
 */
function rd_duplicate_post_as_draft(){
  global $wpdb;
  if (! ( isset( $_GET['post']) || isset( $_POST['post'])  || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
    wp_die('No post to duplicate has been supplied!');
  }
 
  /*
   * Nonce verification
   */
  if ( !isset( $GET['duplicate_nonce'] ) || !wp_verify_nonce( $_GET['duplicate_nonce'], basename( __FILE_ ) ) )
    return;
 
  /*
   * get the original post id
   */
  $post_id = (isset($_GET['post']) ? absint( $_GET['post'] ) : absint( $_POST['post'] ) );
  /*
   * and all the original post data then
   */
  $post = get_post( $post_id );
 
  /*
   * if you don't want current user to be the new post author,
   * then change next couple of lines to this: $new_post_author = $post->post_author;
   */
  $current_user = wp_get_current_user();
  $new_post_author = $current_user->ID;
 
  /*
   * if post data exists, create the post duplicate
   */
  if (isset( $post ) && $post != null) {
 
    /*
     * new post data array
     */
    $args = array(
      'comment_status' => $post->comment_status,
      'ping_status'    => $post->ping_status,
      'post_author'    => $new_post_author,
      'post_content'   => $post->post_content,
      'post_excerpt'   => $post->post_excerpt,
      'post_name'      => $post->post_name,
      'post_parent'    => $post->post_parent,
      'post_password'  => $post->post_password,
      'post_status'    => 'draft',
      'post_title'     => $post->post_title,
      'post_type'      => $post->post_type,
      'to_ping'        => $post->to_ping,
      'menu_order'     => $post->menu_order
    );
 
    /*
     * insert the post by wp_insert_post() function
     */
    $new_post_id = wp_insert_post( $args );
 
    /*
     * get all current post terms ad set them to the new post draft
     */
    $taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
    foreach ($taxonomies as $taxonomy) {
      $post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
      wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
    }
 
    /*
     * duplicate all post meta just in two SQL queries
     */
    $post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
    if (count($post_meta_infos)!=0) {
      $sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
      foreach ($post_meta_infos as $meta_info) {
        $meta_key = $meta_info->meta_key;
        if( $meta_key == '_wp_old_slug' ) continue;
        $meta_value = addslashes($meta_info->meta_value);
        $sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
      }
      $sql_query.= implode(" UNION ALL ", $sql_query_sel);
      $wpdb->query($sql_query);
    }
 
 
    /*
     * finally, redirect to the edit post screen for the new draft
     */
    wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
    exit;
  } else {
    wp_die('Post creation failed, could not find original post: ' . $post_id);
  }
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
 
/*
 * Add the duplicate link to action list for post_row_actions
 */
function rd_duplicate_post_link( $actions, $post ) {
  if (current_user_can('edit_posts')) {
    $actions['duplicate'] = '<a href="' . wp_nonce_url('admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID, basename(_FILE_), 'duplicate_nonce' ) . '" title="שכפל דף/פוסט זה" rel="permalink">שכפל דף/פוסט</a>';
  }
  return $actions;
}
 
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );

add_filter('page_row_actions', 'rd_duplicate_post_link', 10, 2);
/*** Adds SKUs and product images to WooCommerce order emails */ 
function sww_add_sku_to_wc_emails( $args ) { $args['show_sku'] = true; return $args; } add_filter( 'woocommerce_email_order_items_args', 'sww_add_sku_to_wc_emails' );
/*** Adds product images to WooCommerce order emails */
function sww_add_photos_to_wc_emails( $args ) { $args['show_image'] = true; return $args; } add_filter( 'woocommerce_email_order_items_args', 'sww_add_photos_to_wc_emails' );
function overrule_webhook_disable_limit( $number ) {

    return 999999999999; //very high number hopefully you'll never reach.

}

add_filter( 'woocommerce_max_webhook_delivery_failures', 'overrule_webhook_disable_limit' );
add_filter( 'auto_core_update_send_email', 'wpb_stop_auto_update_emails', 10, 4 );
 
function wpb_stop_update_emails( $send, $type, $core_update, $result ) {
if ( ! empty( $type ) && $type == 'success' ) {
return false;
}
return true;
}
/* DISABLE GUTENBERG EDITOR */
// disable for posts
add_filter('use_block_editor_for_post', '__return_false');

// disable for post types
add_filter('use_block_editor_for_post_type', '__return_false');

/* END DISABLE GUTENBERG EDITOR */ 
# There are a few ways to change the url in wordpress


# The prefered method is the wp-cli via search-replace.
$ wp search-replace 'http://example.test' 'http://example.com' --skip-columns=guid

# You can also test with a dry run
$ wp search-replace 'foo' 'bar' wp_posts wp_postmeta wp_terms --dry-run


# If the wp-cli is not available or you can't use SSH there are three other ways to try inside the files wp-config and functions.php

# At the beginning of wp-config.php, add
define( 'WP_HOME', 'http://example.com' );
define( 'WP_SITEURL', 'http://example.com' );

# At the end of the file, before the comment to stop editing here, you can set the relocate method. This always takes the current url calling "/wp-login.php" as slug as site url.
define('RELOCATE',true);

# Inside funcions.php, as first call, you can set
update_option( 'siteurl', 'http://example.com');
update_option( 'home', 'http://example.com');

# Use Plugin

The plugin 'Better search replace' is also able to change the links in the database quite easily.


# As last resort, you can change the database values manually.You will have to look for "siteurl" in the table "wp_options" and change the values to the correct url.

# After changing the url, don't forget to remove the above settings again. Move to your settings in the backend and check the url. Also, inside the options section, look for "permalinks". It will bring you to an options page where you can regenerate the dynamic links. Without this regenerating, links for assets, media files and so an would possibly keep pointing to the old url. 
WPDBNAME=`cat wp-config.php | grep DB_NAME | cut -d \' -f 4`
WPDBUSER=`cat wp-config.php | grep DB_USER | cut -d \' -f 4`
WPDBPASS=`cat wp-config.php | grep DB_PASSWORD | cut -d \' -f 4`
// Exclude certain pages from WordPress search results
//======================================
function jp_search_filter( $query ) {
  if ( ! $query->is_admin && $query->is_search && $query->is_main_query() ) {
    $query->set( 'post__not_in', array( 827,851 ) );
  }
}
add_action( 'pre_get_posts', 'jp_search_filter' );
//add allowable file types to wordpress media uploader
function custom_mime_types( $mimes ){
	$mimes['vcf'] = 'text/vcard'; //allowing .cvf filetypes
//additional filetypes can go here
	return $mimes;
}
add_filter( 'upload_mimes', 'custom_mime_types' );
add_action( 'woocommerce_after_add_to_cart_quantity', 'ts_quantity_plus_sign' );

function ts_quantity_plus_sign() {
echo '<button type="button" class="plus" >+</button>';
}

add_action( 'woocommerce_before_add_to_cart_quantity', 'ts_quantity_minus_sign' );

function ts_quantity_minus_sign() {
echo '<button type="button" class="minus" >-</button>';
}

add_action( 'wp_footer', 'ts_quantity_plus_minus' );

function ts_quantity_plus_minus() {
// To run this on the single product page
if ( ! is_product() ) return;
?>
<script type="text/javascript">

jQuery(document).ready(function($){

$('form.cart').on( 'click', 'button.plus, button.minus', function() {

// Get current quantity values
var qty = $( this ).closest( 'form.cart' ).find( '.qty' );
var val = parseFloat(qty.val());
var max = parseFloat(qty.attr( 'max' ));
var min = parseFloat(qty.attr( 'min' ));
var step = parseFloat(qty.attr( 'step' ));

// Change the value if plus or minus
if ( $( this ).is( '.plus' ) ) {
if ( max && ( max <= val ) ) {
qty.val( max );
}
else {
qty.val( val + step );
}
}
else {
if ( min && ( min >= val ) ) {
qty.val( min );
}
else if ( val > 1 ) {
qty.val( val - step );
}
}

});

});

</script>
<?php
}
// remove wp version number from head and rss
function artisansweb_remove_version() {
    return '';
}
add_filter('the_generator', 'artisansweb_remove_version');
// remove wp version number from scripts and styles
function remove_css_js_version( $src ) {
    if( strpos( $src, '?ver=' ) )
        $src = remove_query_arg( 'ver', $src );
    return $src;
}
add_filter( 'style_loader_src', 'remove_css_js_version', 9999 );
add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );
//*****---   Remove Gutenberg Block Library CSS from loading on the frontend  ---*****
//===================================================================
function smartwp_remove_wp_block_library_css(){
 wp_dequeue_style( 'wp-block-library' );
 wp_dequeue_style( 'wp-block-library-theme' );
}
add_action( 'wp_enqueue_scripts', 'smartwp_remove_wp_block_library_css' );
//*****---  Remove Eicons:  ---*****
//==========================
add_action( 'wp_enqueue_scripts', 'remove_default_stylesheet', 20 ); 
function remove_default_stylesheet() { 
	wp_deregister_style( 'elementor-icons' ); 
}
//******--- Remove Font Awesome ---*****
//===============================
add_action( 'elementor/frontend/after_register_styles',function() {
	foreach( [ 'solid', 'regular', 'brands' ] as $style ) {
		wp_deregister_style( 'elementor-icons-fa-' . $style );
	}
}, 20 );
******--- Remove Google Fonts ---******
//===============================
add_filter( 'elementor/frontend/print_google_fonts', '__return_false' );
/***** Allow SVG *****/
//===================
add_filter( 'wp_check_filetype_and_ext', function($data, $file, $filename, $mimes) {

  global $wp_version;
  if ( $wp_version !== '4.7.1' ) {
     return $data;
  }

  $filetype = wp_check_filetype( $filename, $mimes );

  return [
      'ext'             => $filetype['ext'],
      'type'            => $filetype['type'],
      'proper_filename' => $data['proper_filename']
  ];

}, 10, 4 );

function cc_mime_types( $mimes ){
  $mimes['svg'] = 'image/svg+xml';
  return $mimes;
}
add_filter( 'upload_mimes', 'cc_mime_types' );

function fix_svg() {
  echo '<style type="text/css">
        .attachment-266x266, .thumbnail img {
             width: 100% !important;
             height: auto !important;
        }
        </style>';
}
add_action( 'admin_head', 'fix_svg' );
/***** Shorten Post/Page link  *****/
//============================
add_filter( 'get_shortlink', function ( $shortlink ) {
    return $shortlink;
});
// disable gutenberg  for posts
//========================
add_filter('use_block_editor_for_post', '__return_false', 10);

// disable gutenberg  for post types
//===========================
add_filter('use_block_editor_for_post_type', '__return_false', 10);
// Set WooCommerce Virtual Order Status to Complete After Payment
add_filter( 'woocommerce_payment_complete_order_status', 'virtual_order_payment_complete_order_status', 10, 2 );
function virtual_order_payment_complete_order_status( $order_status, $order_id ) {
  $order = new WC_Order( $order_id );
  if ( 'processing' == $order_status &&
       ( 'on-hold' == $order->status || 'pending' == $order->status || 'failed' == $order->status ) ) {
    $virtual_order = null;
    if ( count( $order->get_items() ) > 0 ) {
      foreach( $order->get_items() as $item ) {
        if ( 'line_item' == $item['type'] ) {
          $_product = $order->get_product_from_item( $item );
          if ( ! $_product->is_virtual() ) {
            // once we've found one non-virtual product we know we're done, break out of the loop
            $virtual_order = false;
            break;
          } else {
            $virtual_order = true;
          }
        }
      }
    }
    // virtual order, mark as completed
    if ( $virtual_order ) {
      return 'completed';
    }
  }
  // non-virtual order, return original status
  return $order_status;
}
add_filter( 'woocommerce_default_address_fields' , 'custom_override_postcode_validation' );
 
function custom_override_postcode_validation( $address_fields ) {
  $address_fields['postcode']['required'] = false;
  return $address_fields;
}
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' => $query_vars->query['s'],
                    'compare' => 'LIKE'
                )
            )
        );
        $posts = get_posts($args);
        if(empty($posts)) return $search;
        $get_post_ids = array();
        foreach($posts as $post){
            $get_post_ids[] = $post->ID;
        }
        if(sizeof( $get_post_ids ) > 0 ) {
                $search = str_replace( 'AND (((', "AND ((({$wpdb->posts}.ID IN (" . implode( ',', $get_post_ids ) . ")) OR (", $search);
        }
    }
    return $search;
    
}
    add_filter( 'posts_search', 'search_by_sku', 999, 2 );
add_filter( 'woocommerce_default_address_fields' , 'QuadLayers_optional_postcode_checkout' );
function QuadLayers_optional_postcode_checkout( $p_fields ) {
$p_fields['postcode']['required'] = false;
return $p_fields;
}
// Disable support for comments and trackbacks in post types
function sv_disable_comments_post_types_support() {
	$post_types = get_post_types();
	foreach ($post_types as $post_type) {
		if(post_type_supports($post_type, 'comments')) {
			remove_post_type_support($post_type, 'comments');
			remove_post_type_support($post_type, 'trackbacks');
		}
	}
}
add_action('admin_init', 'sv_disable_comments_post_types_support');



// Close comments on the front-end
function sv_disable_comments_status() {
	return false;
}
add_filter('comments_open', 'sv_disable_comments_status', 20, 2);
add_filter('pings_open', 'sv_disable_comments_status', 20, 2);



// Hide existing comments
function sv_disable_comments_hide_existing_comments($comments) {
	$comments = array();
	return $comments;
}
add_filter('comments_array', 'sv_disable_comments_hide_existing_comments', 10, 2);



// Remove comments page in menu
function sv_disable_comments_admin_menu() {
	remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'sv_disable_comments_admin_menu');



// Redirect any user trying to access comments page
function sv_disable_comments_admin_menu_redirect() {
	global $pagenow;
	if ($pagenow === 'edit-comments.php') {
		wp_redirect(admin_url()); exit;
	}
}
add_action('admin_init', 'sv_disable_comments_admin_menu_redirect');



// Remove comments metabox from dashboard
function sv_disable_comments_dashboard() {
	remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
}
add_action('admin_init', 'sv_disable_comments_dashboard');



// Remove comments links from admin bar
function sv_disable_comments_admin_bar() {
	if (is_admin_bar_showing()) {
		remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
	}
}
add_action('init', 'sv_disable_comments_admin_bar');
// Automatically set the image Title, Alt-Text, Caption & Description upon upload
add_action( 'add_attachment', 'my_set_image_meta_upon_image_upload' );
function my_set_image_meta_upon_image_upload( $post_ID ) {
 
    // Check if uploaded file is an image, else do nothing
 
    if ( wp_attachment_is_image( $post_ID ) ) {
 
        $my_image_title = get_post( $post_ID )->post_title;
 
        // Sanitize the title:  remove hyphens, underscores & extra spaces:
        $my_image_title = preg_replace( '%\s*[-_\s]+\s*%', ' ',  $my_image_title );
 
        // Sanitize the title:  capitalize first letter of every word (other letters lower case):
        $my_image_title = ucwords( strtolower( $my_image_title ) );
 
        // Create an array with the image meta (Title, Caption, Description) to be updated
        // Note:  comment out the Excerpt/Caption or Content/Description lines if not needed
        $my_image_meta = array(
            'ID'        => $post_ID,            // Specify the image (ID) to be updated
            'post_title'    => $my_image_title,     // Set image Title to sanitized title
            'post_excerpt'  => $my_image_title,     // Set image Caption (Excerpt) to sanitized title
            'post_content'  => $my_image_title,     // Set image Description (Content) to sanitized title
        );
 
        // Set the image Alt-Text
        update_post_meta( $post_ID, '_wp_attachment_image_alt', $my_image_title );
 
        // Set the image meta (e.g. Title, Excerpt, Content)
        wp_update_post( $my_image_meta );
 
    } 
}
add_action( 'wp_body_open', 'wpdoc_add_custom_body_open_code' );
 
function wpdoc_add_custom_body_open_code() {
    echo '<!-- Google Tag Manager (noscript) --> ... <!-- End Google Tag Manager (noscript) -->';
}
server {
  ...
    location /wp {
        alias /home/user/www/.../wordpress/;
        index index.php index.html index.htm;
        try_files $uri $uri/ /wp/index.php?$is_args$args;
    }
    location ~ \.php$ {
        root /home/user/www/.../wordpress/;
        fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
        fastcgi_split_path_info ^/wp(/.+\.php)(.*)$;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

  ...
}
//This code prevents noreferrer from being added to new or updated posts
function im_targeted_link_rel($rel_values) {
return 'noopener';
}
add_filter('wp_targeted_link_rel', 'im_targeted_link_rel',999);
//add aria label to link that opens in new tab
function aria_formatter($content) {
$replace = array('target="_blank"' => 'target="_blank" aria-label="Opens in a new tab."');
$new_content = strtr($content, $replace);
return $new_content;
}
add_filter('the_content', 'aria_formatter', 999);
<script>
jQuery( document ).ready(function($){
	$(document).on('click','.elementor-location-popup a', function(event){
		elementorProFrontend.modules.popup.closePopup( {}, event);
	})
});
</script>
The 'tax_query' clauses can be nested, to create more complex queries. Example: Display posts that are in the quotes category OR both have the quote post format AND are in the wisdom category:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		'relation' => 'OR',
		array(
			'taxonomy' => 'category',
			'field'    => 'slug',
			'terms'    => array( 'quotes' ),
		),
		array(
                        'relation' => 'AND',
                        array(
			        'taxonomy' => 'post_format',
			        'field'    => 'slug',
			        'terms'    => array( 'post-format-quote' ),
                        ),
                        array(
                                'taxonomy' => 'category',
                                'field'    => 'slug',
                                'terms'    => array( 'wisdom' ),
                        ),
		),
	),
);
$query = new WP_Query( $args );

Display posts from several custom taxonomies:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		'relation' => 'AND',
		array(
			'taxonomy' => 'movie_genre',
			'field'    => 'slug',
			'terms'    => array( 'action', 'comedy' ),
		),
		array(
			'taxonomy' => 'actor',
			'field'    => 'term_id',
			'terms'    => array( 103, 115, 206 ),
			'operator' => 'NOT IN',
		),
	),
);
$query = new WP_Query( $args );
Simple Taxonomy Query:

Display posts tagged with bob, under people custom taxonomy:

$args = array(
	'post_type' => 'post',
	'tax_query' => array(
		array(
			'taxonomy' => 'people',
			'field'    => 'slug',
			'terms'    => 'bob',
		),
	),
);
$query = new WP_Query( $args );
<?php

add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');

function my_theme_enqueue_styles()
{
    wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('child-style', get_stylesheet_directory_uri() . '/style.css', array('parent-style'));
    wp_enqueue_script('custom-script', get_stylesheet_directory_uri() . '/path/to/script.js', '', '', true );
}
[trp_language language="en_US"]

 //Add custom HTML for the English here

[/trp_language]

[trp_language language="fr_FR"]

 //Add custom HTML for the French here

[/trp_language]
star

Sat Jun 25 2022 11:52:14 GMT+0000 (UTC) https://stackoverflow.com/questions/39685167/list-all-the-tags-in-a-wordpress-blog

#wordpress #tags
star

Sat Jun 11 2022 12:05:36 GMT+0000 (UTC) https://stackoverflow.com/questions/52057378/repeater-inside-group-acf-wordpress

#wordpress
star

Thu Jun 02 2022 12:30:50 GMT+0000 (UTC) https://wordpress.stackexchange.com/questions/348870/how-to-access-custom-order-item-meta-data-from-a-meta-key-in-woocommerce

#wordpress #woocommerce #order #item #meta #key
star

Tue May 31 2022 19:36:45 GMT+0000 (UTC) https://stackoverflow.com/questions/47611251/any-way-to-overwrite-get-stock-quantity-in-my-functions-php

#wordpress #php #stock #quantity #filter
star

Tue May 31 2022 14:49:26 GMT+0000 (UTC) https://wordpress.stackexchange.com/questions/53194/wordpress-paginate-wpdb-get-results

#wordpress #wpdb #pagination #php
star

Thu May 26 2022 20:21:06 GMT+0000 (UTC)

#wordpress #php
star

Thu May 26 2022 20:19:53 GMT+0000 (UTC)

#wordpress #html
star

Thu May 26 2022 20:17:54 GMT+0000 (UTC)

#php #wordpress
star

Thu May 26 2022 20:13:46 GMT+0000 (UTC) https://docs.memberpress.com/article/381-how-to-edit-lessons-in-classroom-mode-with-a-page-builder

#php #memberpress #wordpress
star

Fri May 20 2022 16:21:21 GMT+0000 (UTC)

#php #wordpress
star

Thu May 19 2022 08:04:13 GMT+0000 (UTC)

#html #wordpress
star

Tue May 17 2022 14:02:47 GMT+0000 (UTC) https://wpdevdesign.com/taxonomy-term-specific-image-grid-using-meta-box/

#php #metabox #wordpress
star

Thu Apr 28 2022 09:15:28 GMT+0000 (UTC) https://squelchdesign.com/web-design-newbury/woocommerce-detecting-order-complete-on-order-completion/

#woocommerce #wordpress #orders #hook
star

Sat Apr 23 2022 20:08:48 GMT+0000 (UTC) https://pluginrepublic.com/add-custom-cart-item-data-in-woocommerce/

#woocommerce #wordpress #filters
star

Fri Apr 22 2022 23:59:22 GMT+0000 (UTC) https://dev.to/ninjasoards/easy-headless-wordpress-with-nuxt-netlify-5c4a

#php #wordpress
star

Tue Apr 19 2022 16:38:21 GMT+0000 (UTC)

#php #wordpress
star

Tue Mar 22 2022 07:42:56 GMT+0000 (UTC) https://www.wpbeginner.com/wp-tutorials/how-to-set-get-and-delete-wordpress-cookies-like-a-pro/

#php #wordpress
star

Fri Mar 18 2022 12:37:51 GMT+0000 (UTC) https://wordpress.stackexchange.com/questions/131814/if-the-current-user-is-an-administrator-or-editor

#wordpress
star

Tue Mar 15 2022 12:48:38 GMT+0000 (UTC)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 12:44:34 GMT+0000 (UTC)

#wordpress #php #woocommerce
star

Tue Mar 15 2022 10:08:58 GMT+0000 (UTC) https://stackoverflow.com/questions/40403364/how-to-enqueue-scripts-in-wordpress-from-cdn

#javascript #wordpress
star

Tue Mar 15 2022 10:08:38 GMT+0000 (UTC) https://stackoverflow.com/questions/40403364/how-to-enqueue-scripts-in-wordpress-from-cdn

#javascript #wordpress
star

Tue Mar 15 2022 00:31:04 GMT+0000 (UTC)

#php #wordpress
star

Thu Feb 17 2022 09:54:30 GMT+0000 (UTC) https://www.webnots.com/4-ways-to-disable-smart-or-curly-quotes-in-wordpress/

#wordpress #plugin
star

Wed Feb 09 2022 07:22:18 GMT+0000 (UTC) https://faq.o2switch.fr/gestion-site/debug-page-blanche-erreur-500

#php #wordpress #debug
star

Thu Dec 23 2021 14:51:05 GMT+0000 (UTC)

#wordpress #loopw
star

Wed Dec 22 2021 23:16:29 GMT+0000 (UTC) https://es.stackoverflow.com/questions/505679/para-los-que-conocen-wordpress-y-creadores-de-temas/505704#505704

#wordpress #html #php
star

Wed Dec 22 2021 21:29:14 GMT+0000 (UTC) https://snipsave.com/user/richflynn/snippet/CKoeXWGzyW91z9xEma/

#elementor #wordpress
star

Fri Dec 17 2021 17:46:27 GMT+0000 (UTC) https://make.wordpress.org/themes/2021/12/15/reminder-if-your-theme-integrates-with-external-plugins-make-sure-that-they-are-available-before-trying-to-use-them/

#php #wordpress
star

Thu Dec 09 2021 11:10:27 GMT+0000 (UTC)

#mysql #wordpress
star

Wed Dec 01 2021 00:27:48 GMT+0000 (UTC) https://formstyler.com/

#css #contact #cf7 #wordpress
star

Mon Nov 22 2021 19:22:51 GMT+0000 (UTC) https://kinsta.com/nl/kennisbank/voeg-expires-headers-wordpress/

#wordpress #htaccess
star

Thu Nov 18 2021 03:18:48 GMT+0000 (UTC)

#wordpress #php #gutenberg
star

Wed Nov 17 2021 17:57:20 GMT+0000 (UTC) https://desarrollowp.com/blog/tutoriales/mover-los-scripts-al-footer-wordpress/

#javascript #css #wordpress
star

Mon Oct 25 2021 06:55:32 GMT+0000 (UTC) https://github.com/srikat/my-custom-functionality/blob/master/plugin.php

#wordpress #mu-plugins #php
star

Mon Oct 25 2021 06:48:12 GMT+0000 (UTC) https://developer.wordpress.org/reference/functions/wp_enqueue_script/

#wordpress #mu-plugins #jquery
star

Mon Oct 25 2021 06:36:11 GMT+0000 (UTC) https://www.sitepoint.com/wordpress-mu-plugins/

#wordpress #php #mu-plugins
star

Mon Oct 25 2021 05:31:55 GMT+0000 (UTC) https://developer.wordpress.org/block-editor/how-to-guides/block-tutorial/applying-styles-with-stylesheets/

#wordpress #gutenberg #styles
star

Mon Oct 25 2021 05:16:11 GMT+0000 (UTC) https://www.npmjs.com/package/@wordpress/create-block

#wordpress #gutenberg #git #npm
star

Mon Oct 25 2021 04:49:03 GMT+0000 (UTC) https://www.wordstamped.com/1022/full-width-oxygen-block/

#wordpress #oxygen #css #gutenberg
star

Mon Oct 25 2021 04:21:40 GMT+0000 (UTC)

#wordpress #php #wp-config
star

Mon Oct 25 2021 04:15:43 GMT+0000 (UTC)

#wordpress #php #wp-config
star

Mon Oct 25 2021 03:40:24 GMT+0000 (UTC) https://github.com/WebDevStudios/WDS-Required-Plugins

#wordpress #php #plugin
star

Fri Oct 22 2021 16:30:17 GMT+0000 (UTC) https://developer.wordpress.org/reference/functions/add_action/

#php #wordpress #functions #documentation #prority
star

Thu Jul 22 2021 21:24:54 GMT+0000 (UTC)

#php #wordpress
star

Thu Jul 22 2021 21:23:10 GMT+0000 (UTC)

#php #wordpress
star

Mon Jul 05 2021 16:02:04 GMT+0000 (UTC)

#webhook #wordpress
star

Thu Jul 01 2021 10:52:22 GMT+0000 (UTC) https://www.wpbeginner.com/wp-tutorials/how-to-disable-automatic-update-email-notification-in-wordpress/

#wordpress
star

Fri Jun 11 2021 14:15:50 GMT+0000 (UTC) https://developer.wordpress.org/cli/commands/search-replace/, https://wordpress.org/support/article/changing-the-site-url/

#wordpress #configuration #url #network
star

Mon Jun 07 2021 18:06:54 GMT+0000 (UTC) https://stackoverflow.com/questions/7586995/read-variables-from-wp-config-php

#wordpress #database #credentials #automate
star

Wed May 26 2021 10:14:35 GMT+0000 (UTC) https://www.johnparris.com/exclude-certain-pages-from-wordpress-search-results/

#php #wordpress
star

Thu May 13 2021 21:59:34 GMT+0000 (UTC) https://www.clevelandwebdeveloper.com/code-snippets/wordpress-add-allowed-file-types/

#php #wordpress
star

Thu May 13 2021 15:05:08 GMT+0000 (UTC) https://www.tychesoftwares.com/how-to-add-plus-and-minus-buttons-to-the-quantity-input-on-the-product-page-in-woocommerce/

#php #wordpress
star

Wed May 12 2021 22:38:25 GMT+0000 (UTC)

#php #wordpress
star

Wed May 12 2021 22:37:16 GMT+0000 (UTC)

#php #wordpress #elementor
star

Fri May 07 2021 18:34:56 GMT+0000 (UTC)

#php #wordpress
star

Fri May 07 2021 18:34:23 GMT+0000 (UTC)

#php #wordpress
star

Fri May 07 2021 18:33:50 GMT+0000 (UTC)

#php #wordpress
star

Fri May 07 2021 18:25:16 GMT+0000 (UTC)

#php #wordpress #woocomerce
star

Fri May 07 2021 18:21:47 GMT+0000 (UTC)

#php #wordpress
star

Fri May 07 2021 18:15:24 GMT+0000 (UTC) https://wpdev.co.il/%d7%94%d7%92%d7%93%d7%a8%d7%94-%d7%90%d7%95%d7%98%d7%95%d7%9e%d7%98%d7%99%d7%aa-%d7%a9%d7%9c-%d7%9b%d7%95%d7%aa%d7%a8%d7%aa-alt-%d7%9b%d7%99%d7%aa%d7%95%d7%91-%d7%95%d7%aa%d7%99%d7%90%d7%95%d7%a8/

#php #wordpress
star

Sat Mar 06 2021 03:42:11 GMT+0000 (UTC) https://rckflr.com

#wordpress #google #tag #manager #function
star

Thu Oct 01 2020 20:31:22 GMT+0000 (UTC) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Thu Oct 01 2020 20:30:16 GMT+0000 (UTC) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Thu Oct 01 2020 20:29:15 GMT+0000 (UTC) http://man.hubwiz.com/docset/WordPress.docset/Contents/Resources/Documents/codex.wordpress.org/Function_Reference/WP_Query.html

#wordpress #query #taxonomie
star

Wed Aug 26 2020 16:08:48 GMT+0000 (UTC)

#php #wordpress

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension