CategoryUncategorized

Display different FacetWP sorting options per URL

add_filter( 'facetwp_sort_options', 'options_per_url', 10, 2 );

function options_per_url( $options, $params) {
   $uri = FWP()->helper->get_uri();
   if ( $uri == 'demo/product-tag/catalog') { 
      $options = [      
         'default' => [
            'label' => __( 'New arrivals', 'fwp' ),
            'query_args' => [
               'orderby' => 'date',
               'order' => 'DESC',
            ]
         ],
         'popularity_new' => [
            'label' => 'Popual',
            'query_args' => [
               'orderby' => 'post_views',
               'order' => 'DESC',
            ]
         ]
     ];

 }
   else {
      $options = [           
         'price_asc' => [
            'label' => 'Price ASC',
            'query_args' => [
            'orderby' => 'meta_value_num',
               'meta_key' => '_price',
               'order' => 'ASC',
            ]
        ],
        'price_desc' => [
           'label' => 'Price DESC',
           'query_args' => [
              'orderby' => 'meta_value_num',
              'meta_key' => '_price',
              'order' => 'DESC',
           ]


     ],
   }
   return $options;
}

WooCommerce brands page with logos

I used the Categories Images plugin to add images to my attribute terms (pa_brands) and a custom template to create the actual page and add it in my menu.

<div class="row-flex">
		
   <?php foreach (get_terms('pa_brands') as $cat) : ?>
      <div class="child">
		
         <a href="<?php echo get_term_link($cat->slug, 'pa_brands'); ?>"><img src="<?php echo z_taxonomy_image_url($cat->term_id); ?>" /></a>
      </div>
   <?php endforeach; ?>
		
</div>
		
.row-flex {

   display:flex; justify-content: center; align-items: center; flex-wrap: wrap; 

}
.child {
    width: 189px;
    height: 150px;
    margin: auto;
    align-self: flex-start;
    display: flex;
    align-items: center;
 }

WP CLI cheatsheet

Sources:

My recipes:

# Check themes, core, plugins for updates 
alias check-all='wp core check-update && wp plugin list --update=available && wp theme list --update=available'

# Update all that it can be updated
alias update-all='wp core update && wp plugin update --all && wp theme update --all'

# Get all product ids OF category 53
wp wc product list --category=53 --user=2 --field=id

# Update the category of  product with id 374 to 33
wp wc product update 374 --categories='[{"id":33}]' --user=2

# Move products to another category. You have to add the current category otherwise it does not work.

!/usr/bin/bash

for post in $(wp wc product list --category=54 --user=2 --field=id)
do
wp wc product update $post --categories='[{"id":52},{"id":54}]' --user=2
done

# Add these attributes to the products of this category
!/bin/bash
for post in $(wp wc product list --category=57 --user=2 --format=ids)
do
wp wc product update $post  --user=2  --attributes='[{"id":1,"name":"Color","position":0, "visible":true,"options":["Blue","Red"]}]';
done

Using custom attributes in menus and taxonomy archives NOT WORKING FOR SOME REASON

This requires some work on your part, and archives must be enabled.

What this means is that you have to open the attribute name and

for some strange reason no one has a freakin image @#$@%^#$^$%^$%^$%^%$^%$

It Gets Better GIF by GIPHY Studios Originals

READ THIS FIRST WordPress 5.5 Master List

https://wordpress.org/support/topic/read-this-first-wordpress-5-5-master-list/#post-13238244

WordPress 4.8.3 Security Release

WordPress 4.8.3 Security Release

Hello world!

Welcome to WordPress  Simplesteps for WordPress. This is your my first post. Using the SyntaxHighlighter Evolved

 for writing

[php]php code[/php]

SyntaxHighlighter Evolved

 

http://www.viper007bond.com/wordpress-plugins/syntaxhighlighter/