I’ve tried many currency plugins for WooCommerce, but none of them worked well. Some of them were not compatible with coupons, WooCommerce Subscriptions or poorly coded, so I decided to write a tiny WordPress plugin to change the price and currency based on the billing country. What it does? 1. If the billing country is […]
The first thing you need to do is to write some HTML for category and publish date select box. This can be added to a custom template or your home page index.php file.
<?php $get_categories = get_categories(array('hide_empty' => 0)); ?>
if ( $get_categories ) :
foreach ( $get_categories as $cat ) :
<option value="<?php echo $cat->term_id; ?>">
<?php echo $cat->name; ?>
<div class="field-title">Sort by</div>
Now, when we have HTML ready, we also need to show some latest blog posts.
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'template-parts/content-post' );
Create a file called content-post.php […]
I recently had an issue with robots.txt file and Google Search Console. It was showing a 404 error message. The problem was related to Nginx and Yoast SEO plugin. In my case, robots.txt is virtual and generated by Yoast SEO plugin. Nginx throws a 404 error because it can’t find the physical file, but then […]
There were many times when client asked me to customize the current slider template and add new settings to the slider. There are many great sliders in WordPress plugins repository, but they are not extendable – you can’t add new settings to the slider and change the template or it’s very hard. This time I decided to spend a bit more time and create my own slider which you can extend easily.
I had a task to create a PHP script to import simple and variable products from JSON file using the WooCommerce REST API. Thought it might be worth sharing with others because I couldn’t find much information about products import from JSON using the API.
The number of vulnerabilities discovered in WordPress plugins and themes is quite impressive. If you take a look at public exploits databases, you’ll see new vulnerabilities discovered every week.
According to the most recent data, the most common vulnerabilities in WordPress plugins and themes are XSS (Cross-site Scripting) and CSRF (Cross-Site Request Forgery). Less common types of vulnerabilities are SQL Injection, RFI (Remote File Inclusion), LFI (Local File Inclusion), Arbitrary File Upload, Directory Traversal.
I recently had to extend the search to include custom fields in WordPress admin. I created a custom post type called “document” and a few custom fields such as “_file_name” and “_url”. Unfortunately, it’s not possible to search by custom field value in WordPress admin, so I had to hook into the native WordPress search and tweak it.
The autocompletion allows users to select from a pre-populated list of suggestions as they type. There are a number of jQuery autocomplete plugins. I’ll create an autocomplete from the post titles and redirect to a blog post based on selected option value.