Posts

specific category product exclude in shop page woocommerce in wordpress

function custom_pre_get_posts_query( $q ) {     $tax_query = (array) $q->get( 'tax_query' );     $tax_query[] = array(            'taxonomy' => 'product_cat',            'field' => 'slug',            'terms' => array( 'diamond' ), // Don't display products in the clothing category on the shop page.            'operator' => 'NOT IN'     );     $q->set( 'tax_query', $tax_query ); } add_action( 'woocommerce_product_query', 'custom_pre_get_posts_query' );

Only specific category product show on shop page woocommerce wordpress

add_action('pre_get_posts','shop_filter_cat');  function shop_filter_cat($query) {     if (!is_admin() && is_post_type_archive( 'product' ) && $query->is_main_query()) {        $query->set('tax_query', array(                     array ('taxonomy' => 'product_cat',                                        'field' => 'slug',                                         'terms' => 'ring'          ...

WooCommerce - How to create multiple single product template based on category?

/* Diamond Category  */ add_filter( 'template_include', 'so_25789472_template_include' ); function so_25789472_template_include( $template ) {   if ( is_singular('product') && (has_term( 'diamond', 'product_cat')) ) {     $template = get_stylesheet_directory() . '/woocommerce/single-product- diamond.php';   }    return $template; } Reference Site: https://stackoverflow.com/questions/25789472/woocommerce-how-to-create-multiple-single-product-template-based-on-category  

Using PHP loop to add Bootstrap rows and proper column numbers to elements in wordpress post

    <?php if ( have_posts() ) : ?>                     <?php                 $i=0;                   while ( have_posts() ) : the_post(); ?>                                     <?php if ($i%4==0) {  ?>     <div class="row">     <?php } ?>                                                              <div class="col-m...

send notification for multiple device using fcm

<?php    include_once('config.php');          define( 'AIzaSyCYpVYwK42m4k_WAE3Tc-EZwRLo9_A89vA', 'AAAA0r_x_cs:APA91bEMJ8IpI-n1rxE7VwRUbnAFzm9WULKFHfeYehnkhu2RtXc0Tl0YmupuL6mkp8p3mDytINr5fGzJCDKdePKAzmkn1A7bjHletWonepazDSDCU8K4UJFkq-NXbEUlzKB5lvH1AzxX' );               function send_notification ($tokens)         {                               $url = 'https://fcm.googleapis.com/fcm/send';                                      $msg = array( 'body' => 'Couppon notification', 'title' => 'Title Of Notification',               'icon' => 'myicon',/*Default Icon*/               'sound' => 'mySound'/*Default sound*/     ...

send notification to android single device using fcm.

<?php     define( 'AIzaSyCYpVYwK42m4k_WAE3Tc-EZwRLo9_A89vA', 'AAAA0r_x_cs:APA91bEMJ8IpI-n1rxE7VwRUbnAFzm9WULKFHfeYehnkhu2RtXc0Tl0YmupuL6mkp8p3mDytINr5fGzJCDKdePKAzmkn1A7bjHletWonepazDSDCU8K4UJFkq-NXbEUlzKB5lvH1AzxX' );    // $registrationIds = $_GET['id']; $registrationIds =  'evbtIS1d2cw:APA91bHo-Tqi7U6aqkFbsBHFBpi5ZOnmZobEDr2bh9E2KomK_LM7VhIoMm0xQhaPF9AhZ6N1bXD4_WI8AF0WywG417sT_PnFuZn5m8EmTG5ELpMwDQfkaUgNS-0SSQzXP8eR9puwW01c'; //$registrationIds = 'emUWiI8jZdw:APA91bEFMxsyYK62zghRl4UCzydU6LGxzyWQBr9wcrkaIRIkGMhp8gCEcaEzYNE22d8B29kv-saqBiTjkYBgDmsRml3QT-ZZM_55HdHv18TsvfdPmPQzKpVpaa1FDOgVf-9gKBUpgsXC';      $msg = array           ( 'body' => '{"uid":"1235","message":"this is etst"}', 'title' => 'Title Of Notification',               'icon' => 'myicon',/*Default Icon*/               'sound' => 'mySound'/*...

unique array print without php function php

 <?php $inputArray=array(2,3,4,5,6,2,8,10,4); $outputArray = array(); foreach($inputArray as $inputArrayItem) {     foreach($outputArray as $outputArrayItem) {         if($inputArrayItem == $outputArrayItem) {             continue 2;         }     }     $outputArray[] = $inputArrayItem; } print_r($outputArray); ?>