Posts

Remove/disable Review option from Woocommerce Product Pages

Add the below code in active themes functions.php. Edit via FTP or Admin panel editor (Admin panel -> Appearance -> Editor -> functions.php)

add_filter( 'woocommerce_product_tabs', 'woo_remove_reviews_tab', 98 ); function woo_remove_reviews_tab($tabs) { unset($tabs['reviews']); return $tabs; }

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

Create Custom Post Types in WordPress

Add following code into your theme's functions.php

// Register Custom Post Type
function custom_postType() {
$labels = array(
"name" => __( 'Doctors', '' ),
"singular_name" => __( 'Doctor', '' ),
"all_items" => __( 'All Doctors', '' ),
"add_new" => __( 'Add New Doctor', '' ),
"add_new_item" => __( 'Add New Doctor', '' ),
"edit_item" => __( 'Edit Doctor Details', '' ),
);

$args = array(
"label" => __( 'Doctors', '' ),
"labels" => $labels,
"description" => "",
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => false,
"rest_base" => "",
"has_archive" => false,
"show_in_menu" => true,
"exclude_from_search" => false,
"capa…

Remove WordPress Redirecting to Nearest Matching URL

WordPress comes with a nifty feature which enables it to navigate to the closest matching URL if the one typed in doesn’t exist. This reduces the chance of a user getting presented with a 404 page if they’ve slightly mistyped a page’s URL.
Yes, the above is great, but what if we want to disable it? On a site recently I needed to do exactly this when I was using URL’s that didn’t relate to pages and, instead, jumped to different parts of a single page site.
The solution was to add the below code to my theme’sfunctions.phpfile:
remove_filter('template_redirect', 'redirect_canonical');