View dark-mode.scss
@media (prefers-color-scheme: dark) { body, .blog-teaser, article, .sidebar > *, .has-white-background-color, .style-default .box-style, .style-default .box-style-list ul, .style-default .tagcloud, .style-default #wp-calendar, .header, article div, .amzn-native-product-title-container a, ol, ul, .megamenu, .sub-menu, .content-inner > *{ | |
background:#333!important; | |
} | |
a, li, li a, h1, h2, h3, h4, h5, h6, p, blockquote, format > *, .sidebar > *, .blog-teaser h2 a, div, .content-inner > *{ | |
color:#eee!important; | |
} | |
img{ | |
opacity:0.8; | |
} | |
.header-logo img{ |
View custom-in-search.php
<?php // MAKE CUSTOM POST TYPES SEARCHABLE | |
function searchAll( $query ) { | |
if ( $query->is_search ) { $query->set( 'post_type', array( 'site', 'plugin', 'theme', 'person' )); } | |
return $query; | |
} | |
add_filter( 'the_search_query', 'searchAll' ); | |
?> |
View custom-to-rss.php
<?php // ADD CUSTOM POST TYPES TO THE DEFAULT RSS FEED | |
function custom_feed_request( $vars ) { | |
if (isset($vars['feed']) && !isset($vars['post_type'])) | |
$vars['post_type'] = array( 'post', 'site', 'plugin', 'theme', 'person' ); | |
return $vars; | |
} | |
add_filter( 'request', 'custom_feed_request' ); | |
?> |
View excerpt-custom.php
<?php function new_excerpt_more($more) { | |
global $post; | |
remove_filter('excerpt_more', 'new_excerpt_more'); | |
return ' <a class="read-more" href="'. get_permalink($post->ID) . '">' . 'Read more →' . '</a>'; | |
} | |
add_filter('excerpt_more','new_excerpt_more'); | |
?> |
View svg-support.php
<?php | |
// Add these to child theme/theme's functions.php file | |
function cc_mime_types($mimes) { | |
$mimes['svg'] = 'image/svg+xml'; | |
return $mimes; | |
} | |
add_filter('upload_mimes', 'cc_mime_types'); | |
?> |
View google-auto-ads-posts-only.php
<?php add_action('wp_head', 'google_ads'); | |
function google_ads() { | |
if (is_singular('post')){ | |
echo '<script data-ad-client="ca-pub-1495783196891276" async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>'; | |
} | |
// Change data-ad-client="ca-pub-1495783196891276" with your data-ad-client | |
} | |
?> |
View functions.php
<?php | |
add_action( | |
'enqueue_block_editor_assets', | |
function () { | |
$theme = wp_get_theme(); | |
wp_enqueue_style( | |
'gt-main-editor-styles', | |
get_stylesheet_directory_uri() . '/custom-editor.css', | |
[], |
View estimated-reading-time.php
<?php | |
// Insert the following code into the right file (e.g., single.php or page.php) in the right place (above post meta and below post title) in your theme. It counts total words in an article and calculates time by estimating that on average a reader can read 200 words in a minute. | |
$mycontent = $post->post_content; | |
$word = str_word_count(strip_tags($mycontent)); | |
$m = floor($word / 200); | |
// considering 200 words per minute is human ready capacity average | |
$s = floor($word % 200 / (200 / 60)); | |
$est = $m . ' minute' . ($m == 1 ? '' : 's') . ', ' . $s . ' second' . ($s == 1 ? '' : 's'); | |
?> |
View one-click-screenshot.html
<!DOCTYPE html> | |
<html lang="en-US" prefix="og: http://ogp.me/ns#"> | |
<head> | |
<title>One click screenshot of any webpage</title> | |
<meta name="description" content="Get a one to two click screenshot of any webpage in .png. Download and use it on blogs and websites." /> | |
<meta name="robots" content="follow, index, , max-snippet:-1, max-video-preview:-1, max-image-preview:large" /> | |
</head> | |
<body> | |
<form id="your_form" onsubmit="yourFunction()" target="_blank"> | |
<input type="url" name="url"> |
View reduce-comment-spam.php
<?php | |
// Copy this code in your theme's functions.php file before closing ?> | |
// This removes website field from comment forms | |
add_filter('comment_form_default_fields', 'website_remove'); | |
function website_remove($fields) | |
{ | |
if(isset($fields['url'])) |
NewerOlder