React to WordPress - Page 2 of 2 - by kirillrocks

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

Best sources to learn web programming, from basic to an expert!

In this article, I would like to share with you the prime tutorials to start your way in the web programming world. I will mention the best sources to learn from and link to the tutorials that I find the most instructive for a first-time programmer.

Through the article, I will share courses on subjects like Front End Developers(CSS HTML, Javascript) and Back End Developers(PHP, MYSQL, NODEJS). Some of the courses are for absolute beginners and some for expert developers.

Read More

Debug your code faster using custom live templates with PhpStorm

As a programmer and a team leader, I don’t have time to waste on debugging broken pieces of code. I need to do it fast with little to no mess. To do so, I’m using the help of PhpStorm live templates system

What are Live Templates?

Live templates are shortcodes that connecting to certain code patterns that you can re-use inside of your code with a click of a TAB. That allows you to easily create huge blocks of code by typing only a couple of characters and clicking TAB.

A live template could be as simple as just an echo statement:

echo "$END$";
phpstorm live template eco
Default “eco” Live Template

Read More

How to Open Android AVD/SDK (Android Virtual Device) manager inside Webstorm / Phpstorm on Windows (simple workaround)

Some of you might think “why would I need to open AVD inside Webstorm?”, and maybe even be correct, as the newest versions of Android Studio working on the Intellij Engine as well(and also doing it pretty well).

But, the programmers that are working with WebStorm or PhpStorm on the daily, they wouldn’t want to move to Android Studio every time they decide to work on a React Native project.

As one of those “programmers”, I have found a simple workaround that works for me. Follow this steps, and you will be able to use Android AVD within WebStorm in no-time.

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

What is React and where to learn it?

updated 13 April 2018

Complete Modern React and Redux Course by Stephen Grider

As a developer that loves learning new technologies and never stay behind, I decided to leave Angular(with the exit of Angular 5) and move to a different world. Faster, stronger, better and more advanced – the React world, and I have never looked back.

Before we even start talking about React, I want to share my 2 cents. As a developer, I have never enjoyed writing code as much as I enjoy doing it with React.

What is React?

In the simplest of words, React is a small Javascript library for creating intuitive web-application, fast and with as minimum code as possible.

Many are comparing Angular to React, which is incorrect. React is a small view library, as, on the other hand, Angular is a full-blown MV* framework.

The founder of React, Jordan Walke, Facebook software engineer, wanted to create a better solution for everyday problems of a front end developer. He wanted to do a much better, smarter, faster way of creating web-application, and yes – he succeeded.

Today, React is being developed by Facebook themselves, although it is a somewhat new technology, React already has million of front end developers supporting and using it in their own projects. The most common ones still would be Facebook Feed and Instagram.

Read More