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.
💡 WordPress theme is a group of files (graphics, style sheets, and code) that controls the overall appearance of your website.
Here you can find tutorials for the most popular themes like Avada and Divi, or discover new themes for your blog.
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.
AJAX enables tasks such as fetching, inserting and deleting records from a MySQL database, as well as file uploading. AJAX sent URL should be admin-ajax.php. wp_ajax action hooks. Here are well-explained tutorials from Yogesh Singh on how to send AJAX requests from a WordPress theme and a WordPress 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
Here is a simple code snippet that you can add to your theme functions.php file to show the “last updated” date in your posts. A new line will be added to the beginning of the post content if the last modified and published time is different:
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 →
Like many other scripts, WordPress also uses PHPmailer to send transactional emails. If no email is set for sending emails, WordPress will use the default cPanel email account ([email protected]) which isn’t pretty. SMTP (Simple Mail Transfer Protocol) is an industry-standard for sending emails. Proper SMTP configuration helps increase email deliverability by using authentication. To specify … Read full article →
Before you choose any WordPress directory theme, can you tell what makes a perfect directory site? If you don’t know the right answer, we’d suggest you should continue reading instead of jumping straight to our list of Best WordPress Directory Themes. Even if you know the basics, these lines can refresh your memory, or probably … Read full article →
Although you can change almost every aspect of WordPress themes, to design your site exactly how you want it, you may occasionally need to add some custom CSS. In WordPress 4.7, a new way to add CSS to your site was added inside the Customizer which you can find in Customize > Additional CSS. However, CSS … Read full article →
PHP has a built-in function get_defined_constants that returns an array with the names of all the constants and their values. Because WordPress is built in PHP, We can use this function to get all WordPress constants. ⚠️ Use this snippet with caution, as the code will display sensitive information including your database username and password … Read full article →
At the time of writing this article (December 03.2022), PHP8 is no longer actively supported and will only receive security support for the next 1 year. New PHP versions offer better optimization and security, but not all plugins, themes, or even WordPress itself is NOT fully compatible with PHP 8.0 How to force your WordPress … Read full article →