Skip to content

Instantly share code, notes, and snippets.

View chuckreynolds's full-sized avatar
🤖
building things

Chuck Reynolds chuckreynolds

🤖
building things
View GitHub Profile
@chuckreynolds
chuckreynolds / Filter pages or content from WordPress search
Last active August 29, 2015 14:24
filter stuff from wordpress search results
@chuckreynolds
chuckreynolds / remove-wp-comments-feed.php
Created July 31, 2015 22:05
wordpress remove comments feed from RSS feeds list
<?php
function remove_comment_feeds( $for_comments ){
if( $for_comments ){
remove_action( 'do_feed_rss2', 'do_feed_rss2', 10, 1 );
remove_action( 'do_feed_atom', 'do_feed_atom', 10, 1 );
}
}
add_action( 'do_feed_rss2', 'remove_comment_feeds', 9, 1 );
add_action( 'do_feed_atom', 'remove_comment_feeds', 9, 1 );
@chuckreynolds
chuckreynolds / Podcast Ping Services
Created September 24, 2009 02:44
Podcast Specific Pings for Wordpress
http://audiorpc.weblogs.com/RPC2
http://www.allpodcasts.com/Ping.aspx
http://www.podnova.com/xmlrpc.srf
http://ping.podcast.com/ping.php
@chuckreynolds
chuckreynolds / Add-default-gravatar-wordpress.php
Created January 15, 2010 02:10
Adds a default Gravatar through functions.php to Wordpress
<?php
// Add a default Gravatar if user doesn't have one
if ( !function_exists('rYno_newgravatar') ) {
function rYno_newgravatar( $avatar_defaults ) {
$newgravatar = get_bloginfo('template_url').'/images/new-gravatar.gif';
$avatar_defaults[$newgravatar] = 'New Custom Gravatar';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'rYno_newgravatar' );
/** Debugging WP */
define('WP_DEBUG', true); //enable the reporting of notices during development - E_ALL
define('WP_DEBUG_DISPLAY', true); //use the globally configured setting for display_errors and not force errors to be displayed
define('WP_DEBUG_LOG', true); //error logging to wp-content/debug.log
define('SCRIPT_DEBUG', true); //loads the development (non-minified) versions of all scripts and CSS and disables compression and concatenation,
define('E_DEPRECATED', false); //E_ALL &amp; ~E_DEPRECATED &amp; ~E_STRICT
define('AUTOSAVE_INTERVAL', '300'); // Autosave interval
define('SAVEQUERIES', true); // Analyse queries
define('WP_POST_REVISIONS', false);
@chuckreynolds
chuckreynolds / add-cpts-to-post-archive.php
Created September 14, 2015 00:51
Add another custom post type into the main blog post archive loop. #WordPress
/**
* Add a CPT into main post/blog archive
*/
add_filter( 'pre_get_posts', 'chuckreynolds_add_cpts_to_post_archive' );
function chuckreynolds_add_cpts_to_post_archive( $query ) {
if ( is_home() && $query->is_main_query() && empty( $query->query_vars['suppress_filters'] ) ) {
$query->set( 'post_type', array(
'post', // assuming you still want normal posts in there
@chuckreynolds
chuckreynolds / cpt-posts-mods.php
Created September 15, 2015 22:11
Change WordPress POSTS menu name, submenu names, and dashicon in the admin menu and associated labels.
<?php
/**
* Change the name of the main Posts menu and submenus
* and change the dashicon of the main menu item
*/
function chuck_change_post_type_menu() {
global $menu;
global $submenu;
@chuckreynolds
chuckreynolds / rcp-change-metabox-priority.php
Last active September 25, 2015 04:20
Restrict Content Pro defaults its post metabox to high. It was displaying above custom meta boxes on my custom post types and well I can't have that. So here's the filter to bump it to low.
<?php
/**
* RCP metabox is higher than cpt metafields so
* let's lower that priority a bit
*/
function chuck_rcp_chill_priority() {
return 'low';
}
add_filter( 'rcp_metabox_priority', 'chuck_rcp_chill_priority' );
@chuckreynolds
chuckreynolds / wp-rem-update-notify-admins.php
Created February 28, 2013 09:45
Remove WordPress Update Notifications Except for Admins
global $user_login;
get_currentuserinfo();
if (!current_user_can('update_plugins')) { /* checks to see if current user can update plugins */
add_action( 'init', create_function( '$a', "remove_action( 'init', 'wp_version_check' );" ), 2 );
add_filter( 'pre_option_update_core', create_function( '$a', "return null;" ) );
}
@chuckreynolds
chuckreynolds / wp-tags-to-cats.sql
Last active December 14, 2015 08:08
SQL Query turn WordPress Tags into Categories
UPDATE wp_term_taxonomy SET taxonomy='post_tag', parent=0 WHERE taxonomy='category';