Posts

Display featured products in custom page using WooCommerce

Image
Step-1: Logged into WordPress simply navigate to the 'Products' section and you'll notice that there is a column containing stars.









Step-2:Display Featured Products with WooCommerce Shortcode

[featured_products per_page="12" columns="4"]

Sites/default folder are not deleting in Drupal (Solved)

Solved by changing the CHMOD attributes of the sites/default/ folder to 777 (it was 555). After I did this, everything else (also set at 777) deleted fine.

Add star ratings for products in woocommerce

add_action('woocommerce_after_shop_loop_item','get_star_rating');function get_star_rating(){global $woocommerce, $product; $average = $product->get_average_rating(); echo '<div class="star-rating"><span style="width:'.(( $average /5)*100).'%"><strong itemprop="ratingValue" class="rating">'.$average.'</strong> '.__('out of 5','woocommerce').'</span></div>';} or
<divclass="product-rating"><?php

Add custom class in wordpress menu

First of all, you need to create a custom navigation menu fromAppearance -> Menus. Then, use thewp_nav_menuwith the following parameters: <?php $args = array('menu_class'=>'nav nav-tabs','menu'=>'(your_menu_id)'); wp_nav_menu( $args );?>or
wp_nav_menu( array('theme_location'=>'top-menu','container'=>'ul','menu_class'=>'add-your-class-here'));

To know more, visit: http://stackoverflow.com/questions/22742630/wp-nav-menu-add-class-on-ul/

Create Custom Post Types in WordPress

Add below code to your theme's functions.php


// Register Custom Post Type
function custom_post_type() {
    $labels = array(
        'name'                  => _x( 'Services', 'Post Type General Name', 'novamovers' ),
        'singular_name'         => _x( 'Service', 'Post Type Singular Name', 'novamovers' ),
        'menu_name'             => __( 'Services', 'novamovers' ),
        'name_admin_bar'        => __( 'Services', 'novamovers' ),
        'archives'              => __( 'Service Archives', 'novamovers' ),
        'attributes'            => __( 'Service Attributes', 'novamovers' ),
        'parent_item_colon'     => __( 'Parent Service:', 'novamovers' ),
        'all_items'             => __( 'All Service', 'novamovers' ),
        'add_new_item'   …

Redirect non-www to www in .htaccess

Change your configuration to this (add a slash): RewriteCond %{HTTP_HOST} ^example.com$ [NC] RewriteRule (.*) http://www.example.com/$1 [R=301,L] Or the solution outlined below (proposed by@broken-mirror) will work for any domain: RewriteEngine On RewriteCond %{HTTP_HOST} !^www\. [NC] RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L] If you need to support http and https and preserve the protocol choice try the following: RewriteRule ^login\$ https://www.%{HTTP_HOST}/login [R=301,L] To know more visit: http://stackoverflow.com/questions/12050590/redirect-non-www-to-www-in-htaccess