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 ('wp_head', 'rkv_new_redirects', 1); // create redirects | |
function rkv_new_redirects() { | |
$newurl = 'http://mynewurl.com'; | |
$slug = basename(get_permalink()); | |
$cat = get_query_var('cat'); | |
$cat_s = get_category ($cat); | |
$c_slug = $cat_s->slug; | |
// set up |
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 rkv_imagelink_setup() { | |
$image_set = get_option( 'image_default_link_type' ); | |
if ($image_set !== 'none') { | |
update_option('image_default_link_type', 'none'); | |
} | |
} | |
add_action('admin_init', 'rkv_imagelink_setup', 10); |
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
// let's go through and get the right image | |
function dg_thumb_waterfall() { | |
global $post; | |
if ( has_post_thumbnail($post->ID) ) { | |
echo '<div class="thumbnail-wrapper">'; | |
the_post_thumbnail('digi-med-thumb'); | |
echo '</div>'; |
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 rkv_search_filter( $where = '' ) { | |
// don't touch anything outside of a search query | |
if(is_admin() || !is_search() ) | |
return $where; | |
// Hide posts older than 2 years old | |
if ( is_search() ){ | |
$where .= "AND post_type = 'post' AND post_date >= '" . date('Y-m-d', strtotime('-730 days')) . "'"; | |
return $where; | |
} |
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
global $post; | |
$content = $post->post_content; | |
echo wpautop($content); |
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
// ************************************************************** | |
// set inputs when clicking labels | |
// ************************************************************** | |
$('div#default_license span.ap_option label[rel="ap_rd"]').each(function() { | |
$(this).click(function() { | |
if($(this).hasClass('disabled-label')) | |
return; |
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
// clean URLs for attachments | |
// http://domain.com/?attachment_id=173 | |
// http://domain.com/attachment/173 | |
function rkv_attachment_urls($wp_rewrite){ | |
$new_rules = array(); | |
$new_rules['media/(\d*)$'] = 'index.php?attachment_id=$matches[1]'; | |
$wp_rewrite->rules = $new_rules + $wp_rewrite->rules; | |
} |
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 amm_change_title($title) { | |
global $post; | |
$type = get_post_type( $post->ID ); | |
$slug = basename(get_permalink( $post->ID )); | |
if( 'page' == $type && 'title-test' == $slug ) | |
$title = esc_attr( 'My Awesome Title' ); |
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
jQuery(document).ready(function($) { | |
//******************************************************** | |
// expand / collapse for settings page | |
//******************************************************** | |
$('div.settings_group div.dg_wrap').hide(); | |
// show or hide new license block licenses | |
$('div.settings_group input.toggle_group').click(function() { | |
var name = $(this).attr('name'); |
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 mc_campaign_content($cid) { | |
$apikey = 'APIKEY'; | |
$method = 'campaignContent'; | |
$archive = 'true'; | |
$request = new WP_Http; | |
$url = 'http://<dc>.api.mailchimp.com/1.3/?method='.$method.'&apikey='.$apikey.'&cid='.$cid.'&for_archive='.$archive.'&output=json'; | |
$response = wp_remote_get ( $url ); |