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 | |
/** | |
* Plugin Name: WordPress Functionality Plugin | |
* Plugin URI: http://rickrduncan.com/wordpress/functionality-plugin | |
* Description: Core WordPress customizations that are theme independent. | |
* Author: Rick R. Duncan - B3Marketing, LLC | |
* Author URI: http://rickrduncan.com | |
* | |
* | |
* Version: 1.0.0 |
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
<head> | |
<?php if (is_single() || is_page()) { ?> | |
<meta name="description" content="<?php $s = trim(str_replace("\r\n", " ", htmlspecialchars(strip_tags($post->post_content)))); if(mb_strlen($s,'UTF-8') > 200){$postdescr = mb_substr($s,0,198,'UTF-8').' …';} else{$postdescr = $s;}; echo $postdescr; ?>" /> | |
<meta property="og:description" content="<?php echo $postdescr; ?>" /> | |
<meta property="og:url" content="http://site.com/<?php global $post; echo $post->post_name; ?>" /> <!-- OR --> | |
<meta property="og:url" content="<?php the_permalink() ?>" /> | |
<meta property="og:title" content="Site Name<?php wp_title(); ?>" /> | |
<meta property="og:headline" content="Site Name<?php wp_title(); ?>" /> | |
<?php if (get_post_meta($post->ID, 'image_id', true)){$postimage = wp_get_attachment_image_src(get_post_meta($post->ID, 'image_id', true), 'full'); ?> | |
<link rel="image_src" href="<?php echo $postimage[0]; ?>" /> |
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 | |
/** | |
* Force SSL on all pages | |
* | |
* @author Joshua David Nelson, joshuadnelson.com | |
**/ | |
add_action( 'template_redirect', 'jdn_force_ssl' ); | |
function jdn_force_ssl() { | |
// force all pages to https:// |
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
@mixin linear-gradient( $deg, $fromColor, $toColor ) { | |
background: -webkit-linear-gradient($deg, $fromColor, $toColor); /* Chrome 10+, Saf5.1+ */ | |
background: -moz-linear-gradient($deg, $fromColor, $toColor); /* FF3.6+ */ | |
background: -ms-linear-gradient($deg, $fromColor, $toColor); /* IE10 */ | |
background: -o-linear-gradient($deg, $fromColor, $toColor); /* Opera 11.10+ */ | |
background: linear-gradient($deg, $fromColor, $toColor); /* W3C */ | |
} | |
.gradient-ash { | |
@include linear-gradient(90deg, #606c88 10%, #3f4c6b 90%); |
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 | |
/* | |
Plugin Name: Power WP Tweaks | |
Plugin URI: http://ankurk91.github.io/ | |
Description: Some common tweaks to optimize WP Site | |
Version: 1.0 | |
Author: ankurk91 | |
Author URI: http://ankurk91.github.io/ | |
License: MIT | |
*/ |
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
add_action( 'upgrader_process_complete', function() { | |
//rocket cache | |
if ( function_exists( 'rocket_clean_domain' ) ) { | |
rocket_clean_domain(); | |
} | |
// wp-super-cache | |
if ( function_exists( 'wp_cache_clear_cache' ) ) { | |
wp_cache_clear_cache(); |
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 | |
function clean_html(&$html) { | |
libxml_use_internal_errors(true) AND libxml_clear_errors(); | |
$whitelist = array( | |
"#text", | |
"a" => array("target", "href", "name", "type", "rel", "download"), | |
"img" => array("src", "alt", "width", "height"), | |
"table" => array("width"), |
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
add_filter( 'script_loader_tag', 'wsds_defer_scripts', 10, 3 ); | |
function wsds_defer_scripts( $tag, $handle, $src ) { | |
$id = get_the_ID(); | |
// The handles of the enqueued scripts we want to defer | |
$defer_scripts = array( | |
'jquery-waypoints', | |
"fl-builder-layout-$id", | |
'devicepx', | |
'tmls_ba_throttle_debounce', | |
'tmls_mousewheel', |
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
function add_defer_attribute($tag, $handle) { | |
// add script handles to the array below | |
$scripts_to_defer = array( | |
'html5', | |
'jquery', | |
'jquery-migrate', | |
'wp-embed', | |
'twentyseventeen-skip-link-focus-fix', | |
'jquery-scrollto', | |
'twentyseventeen-global', |