CSS media queries not working
Add following meta tag inside head tag : <meta name=”viewport” content=”width=device-width” />
Redirecting to a specific page or website url in php
Redirecting to a specific page or website url in php header(“Location : siteurl.php”);
Redirecting to a specific page in javascript
Redirecting to a specific page in javascript: window.location = “not_proccessed.php”; Reloading the current page using javascript: window.location.reload();
how to shorten the_content in wordpress
<?php echo wp_trim_words( get_the_content(), 40, ‘…’ ); ?> $last_space = strrpos( substr(get_the_excerpt(), 0, 216 ), ‘ ‘ ); $cnt1 = substr(get_the_excerpt(),0,$last_space); echo $cnt1;
Adding new field to all categories in worpdress
/***adding malayalam title field to all product categories(product_cat) and taxonomies “writer”,”publisher”,***/ <?php function add_new_cat_field() { <div class=”form-field”> <label for=”term_meta[mal_title]”><?php _e(‘Malayalam Title’, ‘text_domain’); ?></label> <input type=”text” name=”term_meta[mal_title]” id=”term_meta[mal_title]”> <p class=”description”><?php _e(‘Enter a malayalam title’, ‘text_domain’); ?></p> </div> <?php } add_action(‘product_cat_add_form_fields’, ‘add_new_cat_field’); add_action(‘writer_add_form_fields’, ‘add_new_cat_field’); add_action(‘publishers_add_form_fields’, ‘add_new_cat_field’); //Product Cat Edit page function edit_new_cat_field($term) { //getting term ID $term_id…
How to add shortcode for best selling products in store front end theme?
Add following code in your functions.php: function storefront_best_selling_products( $args ) { if ( storefront_is_woocommerce_activated() ) { $args = apply_filters( ‘storefront_best_selling_products_args’, array( ‘limit’ => 5, ‘columns’ => 5, ‘title’ => esc_attr__( ‘Best Sellers’, ‘storefront’ ), ) ); echo ‘<section class=”storefront-product-section storefront-best-selling-products” aria-label=”Best Selling Products”>’; do_action( ‘storefront_homepage_before_best_selling_products’ ); do_action( ‘storefront_homepage_after_best_selling_products_title’ ); echo storefront_do_shortcode( ‘best_selling_products’, array( ‘per_page’…
How to use best selling hook from store front end theme
To use best selling hook in store front end theme. use the hook with different name to already defined “function storefront_best_selling_products”: add_action( ‘homepage1’, ‘storefront_best_selling_products’, 70 );
Getting taxonomy name from post id
global $post; $id=$post->ID; $term_list = wp_get_post_terms($id,’writer’); // Taxonomy name here, we use “writer” print_r($term_list);