• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
Logo

impressive pages: Webdesign und eCommerce

  • Home
  • Blog
  • Hosting
  • Contact

Blog

Visually separate sub-categories of products in WooCommerce – separate ‘ul’ lists

22. December 2021 Leave a Comment

Visually separate sub-categories of products in WooCommerce

With WooCommerce, the sub-categories in front of the products are shown or hidden in the standard version on the category archive page, depending on the configuration. However, it is not possible to display the list separately. If we want to separate the representation and have two separate listings, it is possible to use the following code.

/**
* Move WooCommerce subcategory list items into their own <ul> separate from the product <ul>.
*/
add_action( 'init', 'iphf_move_subcat_list' );
function iphf_move_subcat_list() {
	// Remove the subcat <li>s from the old location.
	remove_filter( 'woocommerce_product_loop_start', 'woocommerce_maybe_show_product_subcategories' );
	add_action( 'woocommerce_before_shop_loop', 'iphf_product_loop_start', 1 );
	add_action( 'woocommerce_before_shop_loop', 'iphf_maybe_show_product_subcategories', 2 );
	add_action( 'woocommerce_before_shop_loop', 'iphf_product_loop_end', 3 );
}
/**
 * Conditonally start the product loop with a <ul> contaner if subcats exist.
 */
function iphf_product_loop_start() {
	$subcategories = woocommerce_maybe_show_product_subcategories();
	if ( $subcategories ) {
		woocommerce_product_loop_start();
	}
}
/**
 * Print the subcat <li>s in our new location.
 */
function iphf_maybe_show_product_subcategories() {
	echo woocommerce_maybe_show_product_subcategories();
}
/**
 * Conditonally end the product loop with a </ul> if subcats exist.
 */
function iphf_product_loop_end() {
	$subcategories = woocommerce_maybe_show_product_subcategories();
	if ( $subcategories ) {
		woocommerce_product_loop_end();
	}
}

This is what it looks like in the frontend:

Move WooCommerce subcategory list items into their own separate from the product

Thus we are able to style the subcategories accordingly and display them as filters, for example. This enables customers to better find products from the catalog.

Thanks to twoelevenjay

Filed Under: WooCommerce, WooCommerce, WordPress, WordPress, WordPress

WordPress 5.9 “Groundbreaking Release” will be available at the end of January 2022

22. December 2021 Leave a Comment

WordPress 5.9

The latest version of the WordPress CMS is expected to appear in January 2022. WordPress.org writes: ” WordPress 5.9 will be the third major release in 2021 and will focus on blocks and intrinsic web design, navigation menus, an interface for theme.json, refining the editing flow for block themes, additional design tools and a new standard theme. In addition, it is possible that the release will also include the insertion and creation of patterns, unzip / rollback failover, PHP unit tests and improved compatibility with PHP 8.0 and 8.1. “(Source: Translation by https://make.wordpress.org/core/5-9/ )

In fact, it won’t appear until early 2022, but the main work on WordPress 5.9 should be finished this year. WordPress has published an introduction video on Youtube:

Introducing WordPress 5.9

This video is embedded by YouTube and resources will be loaded and played from its server when you click on play button. For more information see Google privacy statements.
Presentation of WordPress 5.9 on Youtube

The “rollback fail safes” feature is particularly worth mentioning. This should allow WordPress to revert to the previously installed version after theme or plugin updates fail. That will surely be a great relief for many users and makes WordPress even more robust and secure. It’s not surprising that the community is eagerly awaiting the release of the release.

What functions does WordPress 5.9 bring with it?

  • Blocks and intrinsic web design
  • Navigation menus
  • Interface for theme.json
  • Optimization of the editing processes for block themes
  • New standard theme
  • Additional design tools
  • Insertion and creation of templates
  • Unzip / rollback fail safes
  • PHP unit tests
  • Improved compatibility with PHP 8.0 and 8.1

New standard theme with WordPress 5.9

The version promises improved navigation and design control, as well as easier access to different patterns. This makes it easy to change the look and feel of the website without changing the theme. The appearance of a website is determined in WordPress via themes and it is also possible to develop individual designs.

It was recently announced that a new theme called Twenty Twenty-Two will be part of WordPress 5.9. This should be the most flexible standard theme for WordPress so far.

Release date

WordPress 5.9 is to be published on January 25, 2022 .

Filed Under: development

Set brand property (pa_brand) for all products

22. December 2021 Leave a Comment

We use the following code to programmatically set the pa_brand (German: Marke) property for all products at once.


add_action('admin_init', 'iphf_add_brand_for_all_products');
function iphf_add_brand_for_all_products() {
	$queryArgs = array(
		 'post_type' => 'product',
		 'posts_per_page' => -1
	);

	$my_query = new WP_Query( $queryArgs );

	if( $my_query->have_posts() ) {

	   while ($my_query->have_posts()) : $my_query->the_post(); 

		 $term_taxonomy_ids = wp_set_object_terms( get_the_ID(), 'mein-marke', 'pa_brand', true );
		 $thedata = Array('pa_brand'=>Array(
		   'name'=>'pa_brand',
		   'value'=>'meine-marke',
		   'is_visible' => '1',
		   'is_taxonomy' => '1'
		 ));
		 update_post_meta( get_the_ID(),'_product_attributes', $thedata); 

	   endwhile;
	}

	wp_reset_query();
}

With is_visible a 1 (true) comes when the brand is to be displayed on the product page as “additional information”. If not required, then insert 0. My brand (in bold in the code) must be replaced by the title form (slug) of the brand. The value for the title form can be found in the editing mask of the property (Products -> Properties -> Configure terms at brand and then edit at the corresponding brand).

It is important to remove this code after execution so that the code is not executed every time the admin area is loaded and loading is delayed.

Filed Under: Uncategorized

Remove Google Fonts in Genesis Sample

22. December 2021 Leave a Comment

Google logo

The genesis-sample theme uses Google Fonts. To turn this off, the following is necessary:

//* Remove Google Fonts
add_action( 'wp_print_styles', 'iphf_dequeue_google_fonts_style' );
function iphf_dequeue_google_fonts_style() {
      wp_dequeue_style( 'genesis-sample-fonts' );
}

Filed Under: Genesis framework

How do I remove the word “MENU” from the hamburger menu in Genesis?

22. December 2021 Leave a Comment

How can I remove the word MENU from the Hamburg menu in Genesis?

The mobile menu (so-called hamburger menu) in Genesis has the text “Menu” next to the icon by default. This is of course not ideal for German websites. But there is an easy way to change that.

To do this, we add the following style statement:

button#genesis-mobile-nav-primary {
    font-size: 0;
}

in our CSS code. Ready!

There is also the option of adapting the theme code. However, the above solution is easier to implement. It is also recommended by the developers of the Genesis framework.

Filed Under: Genesis framework, mobile, WordPress

Activate reviews for all products in WooCommerce (bulk)

22. December 2021 Leave a Comment

Activating ratings for all products works programmatically with the following code:

add_action('admin_init', 'iphf_enable_reviews');

function iphf_enable_reviews() {

    $args = array(
        'post_type'   => 'product',
        'numberposts' => -1,
        'comment_status' => 'closed',
        'post_status' => 'publish',
    );

    $shop_products = get_posts( $args );
    foreach( $shop_products as $item){
        $product = new WC_Product($item->ID);
        wp_update_post( array(
            'ID'    => $item->ID,
            'comment_status' => 'open',
        ) );
    }
}

Insert this code in the functions.php or use it as a plugin and open the admin panel once. After that, all products should have reviews activated. The code can then be removed again.

Filed Under: WooCommerce

  • « Go to Previous Page
  • Go to page 1
  • Go to page 2
  • Go to page 3
  • Go to page 4
  • Go to Next Page »

Primary Sidebar

Search

Recent Posts

  • WooCommerce: Show free shipping only
  • Remove wrapper DIVs (.wrap) in Genesis
  • Remove the number of products in the category list from the category name
  • Change the number of similar products in WooCommerce
  • Genesis Visual Hook Guide

Categories

  • development
  • Genesis framework
  • Google Search Console
  • mobile
  • SEO
  • Uncategorized
  • Web hosting
  • WooCommerce
  • WordPress

Archives

  • May 2022
  • January 2022
  • December 2021
  • imprint
  • Data protection

Footer

!pages
Heinrich Franz
Wilhelm-Martin-Str. 4
76356 Weingarten (Baden)
instagram
+49 160 85 40 725
info@impressive-pages.de

In my Blog I publish articles about WordPress, Genesis framework und SEO.

© 2022 impressive pages

  • Deutsch