Tuesday, September 20, 2016

How to fetch pages, categories, subcategories in WordPress menu

In this tutorial we will see how we can fetch pages, categories, subcategories in our menu and display in our WordPress website.

First we need to create a custom menu in WordPress.

1. Check menu link under appearance of WordPress admin panel

If the menu link is present under the appearance then you can discard the following steps.

If the menu link is not present then it means that your WordPress theme does not supports custom menus. To enable custom menu support in your theme add the following code in your functions.php file present inside your theme.

register_nav_menus( array(
 'primary_menu' => 'Main Menu',
));

The above code will add custom menu support in your WordPress theme. Now you can find menu link under appearance.

2. Create all pages, categories and subcategories in your WordPress website.

Next you can create all the pages, categories and subcategories from the administrator section of the website as per your requirement.

Create Pages, Categories and Subcategories that you want to keep in the menu of the website.

Now go to the menu under appearance in the administrator section of the website and create a menu.

You can give a name for the menu like "Primary Menu".

3. Displaying the menu in the WordPress website

After the menu is created we can display the menu in the header section of our WordPress theme.

Go to the theme folder and edit your header.php file.
In the header.php file you can add the following code.

<nav class="navigation">
                <?php
                                    wp_nav_menu( array(
                                        'theme_location' => 'primary_menu',
                                        'container' => 'none',
                                     ) );
                                ?>
 </nav><!-- End navigation -->

In the above code 'primary_menu' is the menu location identifier.

The argument container=>none in the above code tells that the menu <ul>....</ul> doesn't needs a container. The default container is <div>.

You can also create multiple menus by following the above process.


Saturday, September 17, 2016

the best plugin for eCommerce in wordpress is WooCommerce

Out of many plugins used for eCommerce in WordPress , WooCommerce is one of the popular plugin. Moreover it is free of cost, so anybody who wishes to launch an eCommerce website using WordPress can easily do so.

The most important aspect of WooCommerce is that you can download lots of free extensions which will help you to add some functionalities in your existing eCommerce website. Along with that we can also install some of the advanced features of eCommerce in WordPress by purchasing some of the extensions at a very nominal cost. So, we can easily meet our specific needs by using hundreds of free and paid WooCommerce extensions.

you can easily locate the WooCommerce at https://woocommerce.com/.

Some of the popular WooCommerce extensions can be found at https://woocommerce.com/product-category/woocommerce-extensions/

One of the popular extension for payment is WooCommerce PayPal Powered by Braintree Gateway.

WooCommerce has one one of the powerful features that we get in full fledged eCommerce platform like magento  i.e. we can add price based on the attributes like size and color.

With the help of WooCommerce plugin for WordPress and its extension WooCommerce PayPal by Braintree we can easily launch a full eCommerce in WordPress.

We don't have to develop theme for our eCommerce from scratch. WooCommerce also provides a free theme called storefront which is easy to use and which can be customized easily to develop an eCommerce store.