How to show page content in feed?

First set the post type to display on main feed page i.e. /feed using pre_get_posts hook $q->set(‘post_type’, array(‘post’, ‘page’)); On individual page WordPress shows comment feed then set it to false and display page content in feed. $q->is_comment_feed = false; In feed template WordPress calls the_excerpt_rss() which calls get_the_excerpt() so using excerpt_length filter change the … Read more

How to add a custom CSS class to core blocks in Gutenberg editor?

There are issues in the answer marked as correct. It will break the alignment class functionality, and is not actually adding to the classList, instead it is overriding it. And you will only be able to use that one solution for your whole theme. Instead you can use “registerBlockStyle()” to add a style variation to … Read more

Changing WooCommerce Display Price Based on User Role & Category [closed]

Yes there is, you can use the woocommerce_get_price filter hook to filter the value based on user role and return a price accordingly e.g: add_filter(‘woocommerce_get_price’, ‘custom_price_WPA111772’, 10, 2); /** * custom_price_WPA111772 * * filter the price based on category and user role * @param $price * @param $product * @return */ function custom_price_WPA111772($price, $product) { … Read more

How to reorder billing fields in WooCommerce Checkout template? [closed]

Same can be done through functions.php in your (child) theme: add_filter(“woocommerce_checkout_fields”, “order_fields”); function order_fields($fields) { $order = array( “billing_first_name”, “billing_last_name”, “billing_company”, “billing_address_1”, “billing_address_2”, “billing_postcode”, “billing_country”, “billing_email”, “billing_phone” ); foreach($order as $field) { $ordered_fields[$field] = $fields[“billing”][$field]; } $fields[“billing”] = $ordered_fields; return $fields; }

Gutenberg: Is there a way to know if current block is inside InnerBlocks?

getBlockParents will work accurately. You can use getBlockParents with the clientId of the block, getBlockParents will return the all parent blocks id if the current block is under any Blocks. It will return blank if current block is not under any Block here is a method that you can use: const innerBlock = “namespace/block-name”; const … Read more

what is __return_false in filters

WordPress contains built in functions for quickly returning values. They are intended to be used as a quick built in function that returns a common value to a filter hook such as true, false, or an empty array. __return_false — Returns the Boolean value of false. __return_true — Returns the Boolean value of true. __return_empty_array … Read more