WordPress Tricks

Move woocommerce product thumbnail to other place in content section using shortocde

Generally Woocommerce product thumbnail images shows below the main image. But, if you want to show the woocommerce product thumbnail in any places (using shortcode) in the product content or details section then this post will help you. Here are the codes:

Code 1 : This will go in Appearance > Customize >Additional CSS

.bbloomer-thumbs .woocommerce-product-gallery__image {
    width: 32.5%;
    float: left;
    margin-right: 1%;
}
.bbloomer-thumbs {
    overflow: hidden;
    margin-top: 20px;
}
.bbloomer-thumbs * {
    border-radius: 0px !important;
    box-shadow: none;
}
.bbloomer-thumbs .woocommerce-product-gallery__image:nth-child(3n) {
    margin-right: 0px !important;
}

Code 2 :These piece of code will go in your theme’s function.php

remove_action( 'woocommerce_product_thumbnails', 'woocommerce_show_product_thumbnails', 20 );
add_shortcode('thumbg', 'opc');
function opc( $atts) {
 
  ob_start();
    $path = WooCommerce::plugin_path();
    include($path . '/templates/single-product/product-thumbnails.php');
	$output='<div class="bbloomer-thumbs">';
    $output .= ob_get_contents();
	$output .='</div>';
    ob_end_clean();
  return $output;
}

Now Put this shortcode [thumbg] where you want to show the woocommerce product thumbnail images.

WordPress Tricks

In First visit if any of your custom font not loading properly.

If you are using any custom font in your site and during your first visit that font not showing or working, then put this code in your .htaccess file. That will solve the font loading issue.

<FilesMatch "\.(ttf|otf|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
WordPress Tricks

Twenty Twenty Theme: Modifications of Header, Titles, Links, Widget Section and More

Twenty Twenty  now arrived and become the new WordPress default theme. Mainly it is designed with the flexibility of the block editor at its core but you can use Visual Composer or Elementor too. You can use it for your organization or business and also for your traditional blog, the centered content column and considered typography makes it perfect for that as well. Here I am sharing some CSS Modifications which you can use

Download Twenty Twenty Child Theme

Download Twenty Twenty Parent Theme from wordpress.com

Continue reading “Twenty Twenty Theme: Modifications of Header, Titles, Links, Widget Section and More”

WordPress Tricks

Add additional tab in woocommerce single product page and show Advanced Custom field info as tab info

Here I am sharing you the code which will help to show an additional / extra tab in woocommerce single product page, and show Advanced Custom fields info in the description of that tab . Just change the field info and put it in your theme’s function.php and save it.

if(! function_exists('new_tab')){

add_filter('woocommerce_product_tabs','new_tab');

function new_tab($tabs){
$tabs['my_tab']=array(
"title"=> "Product Review",
 "priority"=> 35,
"callback" =>"tab_desc",
);
return $tabs;
}
function tab_desc(){
	global $product;
$id = $product->get_id();
echo  get_field('review',$id); ;
}


}

Feel free to do comments if you have any question.

WordPress Tricks

Show 4 Post, One in Left and 3 in right with featured image: In Elementor Builder

Mainly I created the shortcode to show 4 post as per the design above, One in left and Three in right based on the request of one of my client. He wanted to show 4 post in such manner in Elementor page builder plugins. You have to use [recent_posts] in Elementor shortcode module to show it.

The code is divided in 2 part. One for Functions.php and other for Style.css

Code for function.php

Continue reading “Show 4 Post, One in Left and 3 in right with featured image: In Elementor Builder”

WordPress Tricks

Map With Different location pins and mouse activity disabled

This is for advanced users, just shared the code. You can use it in your site by changing the Pin Location name and address. Applicable for wordpress, html and php based sites. Feel free to do comments if you have any question regarding this.

Continue reading “Map With Different location pins and mouse activity disabled”

WordPress Tricks

Create Custom Post type and Category (taxonomy) for your Yoga, Teaching, travel, portfolio ,booking or gym workout based site

Just paste the following Code in your theme’s function.php

In the following Code, I have created Instruction post type with Weeks taxonomy (category) for one of my client. He requested me to show his workout plan based on Week and Day basis. So Just change the Name of Post type and taxonomy and save it.

function instruction_post_type_register(){

register_post_type('instructions',array(

'label'=> 'Instructions',
'public' =>true
));
register_taxonomy('weeks','instructions',array(
'labels'=> array(
    'name'=>'Weeks',
    'add_new_item'=>'Add New Week',
    'parent_item'=> 'Parent Week'
    ),
'hierarchical'=>true

));
}
add_action('init','instruction_post_type_register');

Feel free to do comments if you need any sort of helps.

WordPress Tricks

TwentySeventeen Theme Sidebar in Static Homepage with Comments Form

The main requirement was, to show sidebar in static homepage in twentyseventeen theme with comments form. Check the screenshot

Solution

I have created a template,named Home Sidebar for twentyseventeen theme . I am sharing the template with you

Put this template in your twentyseventeen theme folder and use it to create page with sidebar and comments form.

Continue reading “TwentySeventeen Theme Sidebar in Static Homepage with Comments Form”