This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Exclude Posts from Any Specific Category from RSS Feed in WordPress | |
* | |
* Use Case: | |
* This function is designed for a scenario where you manage a website that publishes content | |
* across ten different categories, but one specific category contains sensitive or restricted content. | |
* To comply with your content distribution policy, you may wish to exclude that particular category | |
* from appearing in the RSS feed. | |
* | |
* Solution: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* By default, users with the Contributor role cannot upload images. | |
* The following snippet overrides this restriction, allowing them to upload images. | |
*/ | |
function allow_contributor_uploads() { | |
$role = get_role( 'contributor' ); | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.separate-containers .page-header { | |
border: none; | |
margin-left: 15px; | |
} | |
/* Main container styles */ | |
.post-type-archive-web-story .site-main { | |
display: flex; | |
flex-wrap: wrap; | |
justify-content: center; /* Centers the stories */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Skip this line, beautification only. Start copying from Line #2. | |
function add_feedify_checkbox_enabler() { | |
?> | |
<script type="text/javascript"> | |
(function($) { | |
$(document).ready(function() { | |
function enableFeedifyCheckbox() { | |
var checkbox = $('#s_f_noti'); | |
if (checkbox.length) { | |
checkbox.prop('disabled', false).prop('checked', true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php // Place this snippet in the functions.php file or use the Code Snippets plugin without PHP opening tags | |
/* | |
* Concepts behind the solution | |
* Google says: If you've followed the best practices above | |
* and find incorrect dates are being selected, | |
* consider if you can remove or minimize other dates that may appear on the page. | |
* https://developers.google.com/search/blog/2019/03/help-google-search-know-best-date-for | |
* | |
* Note: It worked for us. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Yikes! I deleted a category in WordPress by mistake. Now what? | |
Well, if you have an old backup, you can extract the list of Post IDs from that specific category. | |
This is an alternative approach to restoring the entire backup. | |
Let's say the category name was 'College & Admission' with the slug 'college-admission'. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>example.com</title> | |
<style> | |
body, html { | |
height: 100%; | |
margin: 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Special condition: If your WordPress has a settings to automatically approve all comments without a manual approval | |
* In this case, Cloudflare plugin may not purge the cache. | |
* This is a quick-workaround. After adding this snippet, | |
* you need to create a rule to bypass the Cache for comment-posted=true query string | |
*/ | |
add_filter( 'comment_post_redirect', 'redirect_after_comment' ); | |
function redirect_after_comment( $location ) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Google Public DNS (8.8.8.8, 8.8.4.4) | |
https://dns.google/cache | |
Cloudflare DNS (1.1.1.1, 1.0.0.1) | |
https://1.1.1.1/purge-cache/ | |
OpenDNS (208.67.222.222, 208.67.220.220) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* News Summary: Display the most important information first. | |
* | |
* This code snippet adds a custom meta box called "News Summary" in the Post editor. | |
* The meta box allows users to input a summary for each post, which will be displayed | |
* at the beginning of the post's content on the single post page. | |
*/ | |
// Register the Summary Meta Box | |
function custom_news_summary_meta_box() { |
NewerOlder