Automatically add featured image Alt Text from post title
The following code snippet will automatically generate Alt Text for all featured images from the Post Title. If you are looking for more settings, check the SEO Friendly Images plugin.
The following code snippet will automatically generate Alt Text for all featured images from the Post Title. If you are looking for more settings, check the SEO Friendly Images plugin.
Here is a snippet that allows you to set a custom image on the WordPress login page and set a custom link: Replace https://your-domain.com/wp-content/uploads/2023/custom-logo.png with your logo https://your-domain.com with your link
wp_delete_post function allows us to permanently delete posts, pages, attachments. When a post is deleted, all the associated content will also be deleted, this includes the comments, custom fields, and category entries. Instructions Parameter PARAMETER TYPE DESCRIPTION DEFAULT REQUIRED $postid intiger article ID 0 no $force_delete boolean skip recycle bin and delete permanently false no … Read full article →
This code snippet will create a new Filter option for WooCommerce: Availability that will allow users to sort products based on stock number. Add the code to your active theme functions.php or create a new Child theme first to make sure that your edits are not deleted after theme update.
WordPress uses the wp_commentmeta and wp_comments tables to store comments and their data. To delete all comments in WordPress simply empty those tables in the database: To delete all spam comments use: To delete all unapproved comments use: NOTE: In the above commands change wp_ prefix with the table prefix that you are using *(view … Read full article →
Step 1. Add the following inside your theme functions.php file or create a new Child theme first and add the code to it: Step 2. Add the shortcode [total_posts] anywhere on the website where you want to display the total number of posts: And it will display the number. 🙂
While developing a custom site I was in a need to represent how many minutes/hours/days the post was published ago instead of the published date. The logic of the code is simple: TIME DISPLAY less than 1 hour XX minutes ago 1 – 24 hours XX hours ago 24 hours – 7 days XX days … Read full article →
Are you looking for the best WooCommerce product image zoom plugin? Are you considering adding zoom options to your e-commerce products? Here are some of the best WooCommerce product image zoom plugins available on the market. Why you should use product image zoom plugin for your WooCommerce store? YITH WooCommerce Product Gallery & Image Zoom The YITH WooCommerce Product Gallery & Image … Read full article →
Here is a small snippet that you can add to your functions.php file to show different menus to logged-in users in WordPress. In this example 5 is the menu ID of the menu shown to logged-in users and 6 is the ID for the menu shown to guests. So, create two menus and copy their … Read full article →
To put a string before the price of WooCommerce product and cart pages, use the WooCommerce filters woocommerce_cart_item_price and woocommerce_get_price_html Add the following code to your active theme functions.php file. Make sure to change <span class=”price-prefix”>TEXT BEFORE THE PRICE</span> with your text or HTML code. NEXT: How to Add text after the price in WooCommerce