Posts

Remove WordPress Redirecting to Nearest Matching URL

The solution is to add the below code to your theme’sfunctions.phpfile:
remove_filter('template_redirect', 'redirect_canonical');

Remove Script and Stylesheet Version in Wordpress

Paste below code in the active themes function.php
add_filter('script_loader_src','remove_version'); add_filter('style_loader_src','remove_version'); functionremove_version($src){ global$wp_version; $version_str='?ver='.$wp_version; $version_str_offset=strlen($src)-strlen($version_str); if(substr($src,$version_str_offset)==$version_str) returnsubstr($src,0,$version_str_offset); else return$src; }

Preventing SQL injection in Codeigniter

In codeIgniter ,we no need to use mysql_real_escape_string() function, Codeigniter provides inbuilt functions and libraries to generate SQL queries by using those methods or functions we can avoid SQL injections.
There are three methods to prevent SQL injections in Codeigniter application, they are
1) Escaping Queries
2) Query Binding
3) Active Record Class
1. Preventing SQL injection in Codeigniter using Escaping Query Method Example: $email=$this->input->post('email'); $query='SELECT * FROM subscribers_tbl WHERE user_name='.$this->db->escape($email); $this->db->query($query); 2. Preventing SQL injection in Codeigniter using Query Binding Method Example: $sql="SELECT * FROM subscribers_tbl WHERE status = ? AND email= ?"; $this->db->query($sql,array('active','support@keredari.com)); 3. Preventing SQL injection in Codeigniter using Active Record Class $this->db->get_where('subscribers_tbl',array('status'=>…

Remove paypal checkout on product page in Prestshop

Follow below steps to fix it:
1. Login into admin panel
2. Click to Position under Module and Serives tab
3. Scroll to displayFooterProduct and unhook it.
That's it.

Add Cross-sells to single product template in Woocommerce

Step 1: get the ids of the cross sell products using the  ‘_crosssell_ids’ meta key.
<?php/* crossells */$crosssell_ids= get_post_meta( get_the_ID(),'_crosssell_ids');$crosssell_ids=$crosssell_ids[0];?>Step 2: Loop through the products by id
<?phpif(count($crosssell_ids)>0){$args=array('post_type'=>'product','posts_per_page'=>10,'post__in'=>$crosssell_ids);$loop=new WP_Query($args);while($loop->have_posts()):$loop->the_post();?><a href='<?php the_permalink();?>'><?php the_post_thumbnail('thumbnail'); the_title();?></a><?phpendwhile;}?>

Display product short description in woocommerce cart or checkout page

In order to add a short description to WooCommerce cart or checkout page, you could use a code, similar to the following:
<?php echo $_product->post->post_excerpt;?>