This file contains 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 add_action('init', function() { | |
register_block_style('core/image', [ | |
'name' => 'browser-shot', | |
'label' => __('BrowserShot', 'md'), | |
'inline_style' => '.is-style-browser-shot, .browser-shot { border-top: 2em solid rgba(230, 230, 230, 0.7); box-shadow: 0 0.1em 1em 0 rgba(0, 0, 0, 0.2); position: relative; border-radius: 3px 3px 0 0; background:#fff; } .is-style-browser-shot:before, .browser-shot:before { display: block; position: absolute; content: ''; top: -1.25em; left: 1em; width: 0.5em; height: 0.5em; border-radius: 50%; background-color: #f44; box-shadow: 0 0 0 2px #f44, 1.5em 0 0 2px #9b3, 3em 0 0 2px #fb5; }' | |
]); | |
}); |
This file contains 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
body:not(.transparent-header) #header.header-standard.stick-on-scroll { | |
position: -webkit-sticky; | |
position: sticky; | |
top: 0; | |
/* z-index: 9; */ | |
background-color: rgb(255 255 255 / 89%); | |
backdrop-filter:blur(5px); | |
} | |
.admin-bar .header-standard.stick-on-scroll { | |
top: 32px!important; |
This file contains 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
<script> | |
document.addEventListener('DOMContentLoaded', function() { | |
if (document.getElementById('rank-math-toc')) { | |
// Create the new anchor element | |
var tocLink = document.createElement('a'); | |
tocLink.setAttribute('href', '#rank-math-toc'); | |
tocLink.setAttribute('class', 'toc-callout'); | |
tocLink.textContent = 'Table of Contents'; | |
// Insert the new element before the closing body tag |
This file contains 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 | |
// A function that takes a content string and returns an array of up to 3 sentences with the highest scores | |
function gtcontent_summarize($content) { | |
$content = str_replace("’","'", $content); | |
$content = str_replace("; ",".", $content); | |
$content = remove_h2_to_h6_and_no_period($content); | |
$content = wp_strip_all_tags($content,true); | |
$content = wp_trim_words($content,700); |
This file contains 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
<!-- wp:generateblocks/container {"uniqueId":"c9ad37d4","tagName":"section","backgroundColor":"#080808","gradientDirection":90,"gradientColorOne":"rgba(255, 255, 255, 0.1)","gradientColorTwo":"rgba(0, 0, 0, 0.30)","textColor":"#ffffff","bgImage":{"id":1115539,"image":{"url":"https://gauravtiwari.org/wp-content/uploads/2024/01/Gaurav-Tiwari-Cover.webp","height":1277,"width":2362,"orientation":"landscape"}},"bgOptions":{"selector":"pseudo-element","opacity":0.51,"overlay":false,"position":"center right","size":"cover","repeat":"no-repeat","attachment":""},"isDynamic":true,"blockVersion":4,"position":"relative","overflowX":"hidden","overflowY":"hidden","spacing":{"paddingTop":"120px"},"borders":{"borderBottomWidth":"1px","borderBottomStyle":"solid","borderBottomColor":"#e5e7eb"}} --> | |
<!-- wp:generateblocks/container {"uniqueId":"4a4e281f","bgOptions":{"selector":"element","opacity":1,"overlay":false,"position":"center center","size":"contain","repeat":"no-repeat","attachment":"fixed"},"isDynamic":true,"blockVers |
This file contains 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
document.addEventListener('DOMContentLoaded', function() { | |
// Select specific tags. | |
var tags = document.querySelectorAll('header, main, footer, article, nav'); | |
// Function to convert ID to a readable format. | |
function formatIdToReadableText(id) { | |
// Replace non-alphanumeric characters with spaces and trim any extra spaces. | |
var formatted = id.replace(/[^a-zA-Z0-9]/g, ' ').trim(); | |
// Capitalize the first letter of each word. |
This file contains 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
document.addEventListener('DOMContentLoaded', function() { | |
// Find all elements with the class 'share-text' | |
var shareTextElements = document.querySelectorAll('.share-text'); | |
shareTextElements.forEach(function(shareTextElement) { | |
// Find child elements with a class starting with 'md-icon-' | |
var shareIcons = shareTextElement.querySelectorAll('[class*="md-icon-"]'); | |
shareIcons.forEach(function(icon) { | |
// Extract the part of the class name after 'md-icon-' |
This file contains 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 | |
/** | |
* Adds a featured image to RSS feeds. | |
* | |
* @param string $content The content of the post. | |
* @return string Modified content with featured image. | |
*/ | |
function prefix_featured_to_rss( $content ) { | |
global $post; |
This file contains 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
<script> | |
window.pmGAID="G-MABC1234"; // Replace G-MABC1234 with your Google Analytics tracking code | |
</script> | |
<script async src="https://gauravtiwari.org/static/js/analytics-minimal-v4.js"></script> | |
<!-- Download and upload this script to your host for the best performance. --> |
This file contains 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 | |
// Paste this in Code Snippets or Child Theme's functions.php file. Get Code Snippets at https://gauravtiwari.org/go/code-snippets | |
function my_custom_gravatar($avatar, $id_or_email, $size, $default, $alt) { | |
$email = ''; | |
if (is_numeric($id_or_email)) { | |
$id = (int) $id_or_email; | |
$user = get_userdata($id); | |
if ($user) $email = $user->user_email; |
NewerOlder