WordPress Archives - React to WordPress

Best WordPress Web Hosting in 2018 (updated August)

While choosing a domain name for your WordPress website is easy, choosing a hosting service is another story. Fortunately, I am here to spare you from the search for the best web hosting company for your WordPress website, I am here to tell you that SiteGround, is the company I fell in love with, not just because their support is the best I ever spoke to, but they never tried to close any of my client’s websites because they were using “too much” CPU.

Oh, and yes, they are the primary choice for most of the WordPress community.

Read More

How to change the publish date on WordPress for Google search results

Maybe I’m a little slow, but for me, it took a while to understand why is it Google so stubborn to not taking into consideration my modified date and showing it in the search results. After adding million of useless tags – I have found the solution for it.

Before we start…

I know you probably tried and searched functions, methods, tags like Last modified, dateModified, dateCreated and much more – those tags are not being used by Google in a direct way(as it is not part of the “rich data” information that’s appearing on the search results).

This article will show you a 100% solution for showing and modifying the times Google is showing in the search results.

Read More

WooCommerce Hide Product Price (No Plugin Needed)

Hello, In this simple tutorial I will show you; how to hide your WooCommerce product price even if it’s not set to zero. You will not need to install any plugins or bang your head around on how to implement the code – everything is explained.

Also look WooCommerce Hide Products Without Price (Simple Fix)

How to apply “WooCommerce Hide Product Price” Fix?

This is relatively simple; you have two options, choose one:

  1. Edit your functions.php file with your favorite FTP client add this functions to the end of the file.
  2. Edit through the WordPress theme editor located at Appearance > Editor > functions.php and add this functions to the end of the file.

Read More

WooCommerce Hide Products Without Price (Simple Fix)

Hello and welcome to this simple snippet, Here I will show you on how to hide WooCommerce products which don’t have a price or the price is zero.

Also see WooCommerce Hide Product Price (No Plugin Needed)

How to Apply “WooCommerce Hide Products Without Price”?

This is relatively simple; you have two options, choose one:

  1. Edit your functions.php file with your favorite FTP client add this functions to the end of the file.
  2. Edit through the WordPress theme editor located at Appearance > Editor > functions.php and add this functions to the end of the file.

Hide Products Without Price Hook

1. Hide products with the price set to zero in WooCommerce

add_action( 'woocommerce_product_query', 'react2wp_hide_products_higher_than_zero' );
function react2wp_hide_products_higher_than_zero( $q ){
   $meta_query = $q->get( 'meta_query' );
   $meta_query[] = array(
      'key'       => '_price',
      'value'     => 0,
      'compare'   => '>'
   );
   $q->set( 'meta_query', $meta_query );
}

If you add this function to your theme `s functions.php it will make the wp_query to show only products which have the price higher than zero.

Read More

Using same slug for custom post type and custom taxonomy

It is fairly common that you, as a website manager, would like to use the same slug for custom post type as for custom taxonomy, but it is not a simple thing to do if you are not familiar with WordPress permalink structures.

I will explain, say your archive page is `www.domain.com/web-tutorials` – that is the page that will hold all of your posts under the `web-tutorials` custom post type. Now you want your web-tutorial(a singular post) URL to be www.domain.com/web-tutorials/taxonomy-category/post-name

web-tutorials Will be your custom post type slug.

taxonomy-category Your taxonomy category.

post-name Will be your post name/title.

It is impossible to do so without coding customizations, and to my surprise, it is a simple one.

Read More

How to adjust post content before echoing it to the screen?

This one will be quick, I will show you how to adjust, change, nor filter the post’s content before echoing it to the screen.

It is fairly straightforward , you just need to use a WordPress filter for that

add_filter( 'the_content', 'filter_function_name' );

filter_function_name( $content ) {

    if ( is_single() ) {
        $content = str_replace( '<p>', '<p class="p-class">', $content );
    }

    return $content; // a must - return content in any case

}

Read More