Posts tagged "Web Design Dubai"

How to add Custom Taxonomy to Woocommerce Product post type

Custom taxonomy is usually used for storing more data and to show more details about the product.
For example if you selling art and you want to show the artist name for the painting then custom taxonomy would be quite a  good option for you to use as you can add description about the artist so on so forth.

Here’s how easily you can add custom taxonomy to your woocommerce product post type.

You have to add the following code to your function.php in your theme file.

add_action( 'init', 'custom_taxonomy_Item' );

// Register Custom Taxonomy
function custom_taxonomy_Item() {

$labels = array(
'name' => 'Artists',
'singular_name' => 'Artist',
'menu_name' => 'Artist',
'all_items' => 'All Artist',
'parent_item' => 'Parent Artist',
'parent_item_colon' => 'Parent Artist:',
'new_item_name' => 'New Artist Name',
'add_new_item' => 'Add New Artist',
'edit_item' => 'Edit Artist',
'update_item' => 'Update Artist',
'separate_items_with_commas' => 'Separate Artist with commas',
'search_items' => 'Search Artist',
'add_or_remove_items' => 'Add or remove Artist',
'choose_from_most_used' => 'Choose from the most popular Artist',
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => true,
register_taxonomy( 'artist', 'product', $args );

add taxonomy

You just have to change the taxonomy name as per your needs.

What is responsive web design

What is responsive web design?

Responsive web design facilitates the build of a single site that will work across multiple screen resolutions. For example, a responsive website may display in multiple columns when viewed on a desktop/laptop but automatically scale to two columns when accessed via a tablet and one column via a mobile phone.

Responsive front end frameworks

Responsive frameworks are grid structures that are used as the building block for scalable websites. It saves time by giving us the building blocks required to build an effective responsive website. In short, it is a set of code that can be reused so that developers are not constantly reinventing the wheel.

Responsive frameworks are Bootstrap, Base, The Responsive grid System, Foundation etc.

How to add custom tab to woocommerce product page

Woo-commerce Tab

Add a Custom Tab to Product Page

The ‘woocommerce_product_tabs’ filter provided by WooCommerce should be used as below to add a custom tab to a product page in WooCommerce. The code should be added to the functions.php file of your theme.

add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
    $tabs['desc_tab'] = array(
        'title'     => __( 'Delivery and Returns', 'woocommerce' ),
        'priority'  => 50,
        'callback'  => 'woo_new_product_tab_content'
   return $tabs;

Add Content To Tab

To add custom content to the tab you have to add another line of code in the function.php file.

function woo_new_product_tab_content() {
  // The new tab content
  echo '<p>Goods will be delivered....</p>';

Reorder the Tabs

Custom tabs that have been added can also be rearranged as per the requirement. To achieve this the  ‘woocommerce_product_tabs’ filter has to be used once more. The code for the same will be as below.

add_filter( 'woocommerce_product_tabs', 'sb_woo_move_description_tab', 98);
function sb_woo_move_description_tab($tabs) {
    $tabs['desc_tab']['priority'] = 5;
    $tabs['reviews']['priority'] = 20;
    return $tabs;