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
// Given a query string "?to=email&why=because&first=John&Last=smith" | |
// $.getUrlVar("to") will return "email" | |
(function($){ | |
$.getUrlVar = function(key){ | |
var result = new RegExp(key + "=([^&]*)", "i").exec(window.location.search); | |
return result && unescape(result[1]) || ""; | |
}; | |
})(jQuery); |
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
// Automatically set featured post images if missing | |
function op_auto_feature_img() { | |
global $post; | |
$already_has_thumb = has_post_thumbnail($post->ID); | |
if (!$already_has_thumb) { | |
$attached_image = get_children( "post_parent=$post->ID&post_type=attachment&post_mime_type=image&numberposts=1" ); | |
if ($attached_image) { | |
foreach ($attached_image as $attachment_id => $attachment) { | |
set_post_thumbnail($post->ID, $attachment_id); | |
} |
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
// Custom read more link | |
add_filter( 'excerpt_more', 'op_read_more_link' ); | |
add_filter( 'get_the_content_more_link', 'op_read_more_link' ); | |
add_filter( 'the_content_more_link', 'op_read_more_link' ); | |
function op_read_more_link() { | |
return '... <a class="more-link" href="' . get_permalink() . '" rel="nofollow">Continue Reading »</a>'; | |
} |
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
// Add support for Jetpack Infinite Scroll | |
add_theme_support( 'infinite-scroll', array( | |
'container' => 'content', | |
'footer' => 'footer', | |
'render' => 'genesis_do_loop', | |
'footer_widgets' => 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
// Modify the Genesis Default Comment Form | |
add_filter('genesis_comment_form_args','op_email_note'); | |
function op_email_note() { | |
global $user_identity, $id; | |
$req = get_option( 'require_name_email' ); | |
$aria_req = ( $req ? ' aria-required="true"' : '' ); | |
$commenter = wp_get_current_commenter(); | |
if (empty($commenter['comment_author_email'])) { |
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 | |
/* | |
Plugin Name: Custom 404 | |
Plugin URI: http://orangepineapple.com | |
Description: Send 404 page to another page or URL. | |
Version: 2013.08.23 | |
Author: Orangepineapple | |
Author URI: http://orangepineapple.com | |
License: GNU GPL | |
*/ |
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
// Fix embed wmode | |
add_filter( 'embed_oembed_html', 'op_add_video_wmode', 10, 3); | |
function op_add_video_wmode($html, $url, $attr) { | |
if ( strpos( $html, "<embed src=" ) !== false ) { | |
return str_replace('</param><embed', '</param><param name="wmode" value="opaque"></param><embed wmode="opaque" ', $html); | |
} elseif ( strpos ( $html, 'feature=oembed' ) !== false ) { | |
return str_replace( 'feature=oembed', 'feature=oembed&wmode=opaque', $html ); | |
} else { | |
return $html; | |
} |
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
# Force download by filetype | |
<FilesMatch "\.(mp3|pdf)$"> | |
ForceType application/octet-stream | |
Header set Content-Disposition attachment | |
</FilesMatch> |
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
// Improve jpg quality | |
add_filter('jpeg_quality', 'op_jpeg_quality'); | |
function op_jpeg_quality($arg) { | |
return (int)80; // value between 60-100 | |
} | |
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
# WordPress SEO - XML Sitemap Rewrite Fix | |
RewriteEngine On | |
RewriteBase / | |
RewriteRule ^sitemap_index.xml$ /index.php?sitemap=1 [L] | |
RewriteRule ^locations.kml$ /index.php?sitemap=wpseo_local_kml [L] | |
RewriteRule ^geo_sitemap.xml$ /index.php?sitemap=geo [L] | |
RewriteRule ^([^/]+?)-sitemap([0-9]+)?.xml$ /index.php?sitemap=$1&sitemap_n=$2 [L] | |
RewriteRule ^([a-z]+)?-?sitemap.xsl$ /index.php?xsl=$1 [L] | |
# END WordPress SEO - XML Sitemap Rewrite Fix |