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 my_feed_filter($query) { | |
if ( $query->is_feed && 'cpt_shop' === $query->get('post_type') ) { | |
$query->set('order', 'asc'); | |
$query->set('meta_key', '_alt_title'); | |
$query->set('orderby', 'meta_value'); | |
}; | |
return $query; | |
}; | |
add_filter('pre_get_posts','my_feed_filter'); |
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 dbdb_quick_encode($content_text) { | |
$charset = get_bloginfo('charset'); | |
$replaced_text = preg_replace('#(<!--encode-->)(.*?)(<!--/encode-->)#isme', "'$1'.str_replace(array('<!--nextpage-->', '<!--more-->'), array('<!--nextpage-->', '<!--more-->'), '$2').'$3'", $content_text); | |
foreach($replaced_text as $k => $v ) { | |
$encoded_text[$k] = str_replace(array('"'),array('"'), $v); | |
} | |
return $encoded_text; | |
}; | |
add_filter('wp_insert_post_data','dbdb_quick_encode', 1, 1); |
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 post_type_category_fix($request) { | |
if ( isset($request['category_name']) && !isset($request['post_type']) ) | |
$request['post_type'] = 'any'; | |
return $request; | |
}; | |
add_filter('request', 'post_type_category_fix'); |
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 site_mail_from(){ | |
$admin_email = get_option('admin_email'); | |
return $admin_email; | |
}; | |
add_filter('wp_mail_from', 'site_mail_from'); | |
function site_mail_from_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
<?php | |
function my_post_classes( $classes ) { | |
global $multipage, $page, $post, $wp_taxonomies; | |
if($wp_taxonomies) { | |
foreach($wp_taxonomies as $taxonomy) { | |
$tax_array[] = $taxonomy->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
<?php | |
function site_setup() { | |
// This network uses post thumbnails | |
add_theme_support( 'post-thumbnails' ); | |
// enable excerpts on page post_types | |
add_post_type_support('page', 'excerpt'); | |
// Adds RSS feed links to <head> for posts and comments. | |
add_theme_support( 'automatic-feed-links' ); |
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( $ ) { | |
$('a[href^="http://"]').filter(function(){ | |
// filter out links that have the same domain name as the current page | |
return this.hostname && this.hostname !== location.hostname; | |
}) | |
// add a CSS class of "external" to each external link (for styling) | |
.addClass("external") |
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 | |
/** | |
* Load a template file on single-post-type page (if applicable) | |
* | |
* Works for all post-types | |
*/ | |
function dbdb_include_post_template($template) { | |
if( !is_archive() ) { | |
$id = get_queried_object_id(); | |
$template_name = get_post_meta($id, '_wp_page_template', true); |