Keeping image captions and alt text consistent can save time when managing media. This snippet automatically copies the image’s Alt Text to its Caption if the caption is empty when the attachment is saved. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Edit or […]
Highlight newly published content by automatically displaying a “New” badge next to post titles for a specified number of days. This helps attract attention to fresh content and improves user engagement. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Newly published posts (within the […]
Enhance the reading experience by displaying a progress bar at the top of your website that fills as visitors scroll through a post. This feature is commonly found on news, blog, and documentation websites. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Open any […]
Show an estimated reading time at the beginning of every blog post based on the content length. This gives readers a quick idea of how long the article will take to read and can improve engagement. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. […]
This snippet allows you to automatically change a published post to Draft after a specified expiration date stored in a custom field named post_expiry_date. It’s useful for job listings, promotions, announcements, events, and time-sensitive content. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Add […]
Description This snippet prevents users from publishing or updating a post with a title that already exists for the same post type. It’s especially useful for news sites, documentation websites, product catalogs, and large blogs where duplicate titles can cause confusion. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the […]
Description When you upload a PDF, WordPress automatically generates a preview image (thumbnail). If your website doesn’t use PDF previews, disabling this feature can reduce server processing time and save storage space. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Upload a new PDF […]
Description Images without alt text can negatively impact accessibility and SEO. This snippet automatically uses the image attachment title as the alt attribute whenever an uploaded image doesn’t already have one. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. Newly displayed images without an […]
Keep the website header visible while scrolling. This improves navigation and user experience, especially on long pages. Usage Apply the .site-header class to your header element. <header class=”site-header”> <!– Header Content –> </header>
This snippet automatically adds rel=”noopener noreferrer” to external links in post content that open in a new tab (target=”_blank”). It improves security by preventing the linked page from accessing your website through the window.opener object. Steps Open your active theme’s functions.php file or a custom functionality plugin. Add the code below. Save the file. External […]