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 / dabblet.css
Created May 7, 2013 03:11 — forked from vasilisvg/dabblet.css
A simple menu with a :hover action
/**
* A simple menu with a :hover action
*/
html {
background: #f06;
background: linear-gradient(45deg, #f06, yellow);
min-height: 100%;
font: 100%/2.5 helvetica, arial;
}
@chuckreynolds
chuckreynolds / wordpress-text-widget-oembed.php
Created May 7, 2013 22:24
Enable oEmbed functionality in WordPress text widgets
add_filter( 'widget_text', array( $wp_embed, 'run_shortcode' ), 8 );
add_filter( 'widget_text', array( $wp_embed, 'autoembed'), 8 );
@chuckreynolds
chuckreynolds / wordpress-disable-image-attachment-page.php
Created May 8, 2013 19:14
How to Disable WordPress Image Attachment Pages. Note, Yoast SEO has this as an option under Permalinks but if you're not using that...
wp_redirect(get_permalink($post->post_parent));
@chuckreynolds
chuckreynolds / disable-wordpress-post-format-ui.php
Created May 16, 2013 00:45
Filter to disable the Post Format UI in WordPress 3.6+
add_filter( 'enable_post_format_ui', '__return_false' );
@chuckreynolds
chuckreynolds / replace-howdy-wordpress.php
Created May 28, 2013 03:58
Replace "Howdy" text in WordPress admin bar
function _straps_replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', 'Logged in as, ', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', '_straps_replace_howdy' );
@chuckreynolds
chuckreynolds / wordpress-change-domain-migration.sql
Last active February 10, 2023 18:56
UPDATE: Use WP-CLI find-replace command to edit URLs in your database. https://developer.wordpress.org/cli/commands/search-replace/ Use this SQL script when changing domains on a WordPress site. Whether you’re moving from an old domain to a new domain or you’re changing from a development domain to a production domain this will work. __STEP1: al…
/* Use WP-CLI instead https://developer.wordpress.org/cli/commands/search-replace/ */
SET @oldsite='http://oldsite.com';
SET @newsite='http://newsite.com';
UPDATE wp_options SET option_value = replace(option_value, @oldsite, @newsite) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, @oldsite, @newsite);
UPDATE wp_links SET link_url = replace(link_url, @oldsite, @newsite);
UPDATE wp_postmeta SET meta_value = replace(meta_value, @oldsite, @newsite);
/* only uncomment next line if you want all your current posts to post to RSS again as new */
@chuckreynolds
chuckreynolds / wordpress-wp_query.php
Last active February 15, 2018 01:09 — forked from billerickson/gist:2047229
Improve performance of the WordPress WP_Query
<?php
$args = array(
// Normal query goes here //
'no_found_rows' => true, // counts posts, remove if pagination required
'update_post_term_cache' => false, // grabs terms, remove if terms required (category, tag...)
'update_post_meta_cache' => false, // grabs post meta, remove if post meta required
);
@chuckreynolds
chuckreynolds / wordpress-remove-seo-columns.php
Last active March 29, 2020 06:17 — forked from norcross/remove-seo-columns.php
remove WordPress SEO columns from admin post tables
<?php
function rkv_remove_columns( $columns ) {
// remove the Yoast SEO columns
unset( $columns['wpseo-score'] );
unset( $columns['wpseo-title'] );
unset( $columns['wpseo-metadesc'] );
unset( $columns['wpseo-focuskw'] );
@chuckreynolds
chuckreynolds / wordpress-enqueue-jquery.php
Created August 25, 2013 00:14
Properly load jQuery from Google CDN - change version accordingly
function jquery_cdn() {
if (!is_admin()) {
wp_deregister_script('jquery');
wp_register_script('jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js', false, '1.8.3');
wp_enqueue_script('jquery');
}
}
add_action('init', 'jquery_cdn');
@chuckreynolds
chuckreynolds / wp-fix-wpseo-noob-stuff.php
Created March 7, 2014 08:16
This will disable the super noob stuff in WordPress SEO by Yoast plugin. Removes the filters on edit posts screen etc.
if (defined('WPSEO_VERSION')) {
add_filter( 'wpseo_use_page_analysis', '__return_false' );
}