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 / 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 / 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 / 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 / Filter pages or content from WordPress search
Last active August 29, 2015 14:24
filter stuff from wordpress search results
<?php
/**
* == About this Gist ==
*
* Code to add to wp-config.php to enhance information available for debugging.
*
* You would typically add this code below the database, language and salt settings
*
* Oh.. and *do* make sure you change the path to the log file to a proper file path on your server (make sure it exists).
*
@chuckreynolds
chuckreynolds / gist:6478b4d2ad8b61ca560f
Last active August 29, 2015 14:20
Get WPSEO title and description for category, taxonomy archives, pages, posts
<?php
// access wpseo_frontend class and get the seo title and seo description for output on archive pages
if ( class_exists( 'WPSEO_Frontend' ) ) {
$wpseo_object = WPSEO_Frontend::get_instance();
$headline = $wpseo_object->title( false );
$intro_text = $wpseo_object->metadesc( false );
}
$headline = sanitize_text_field( $headline );
$intro_text = sanitize_text_field( $intro_text );
@chuckreynolds
chuckreynolds / common-terminal-commands.md
Last active September 3, 2021 20:17
Common linux / terminal commands I always use but forget. So fuck it I'm saving em here

common terminal commands

ubuntu updates & clean

  • sudo apt update && sudo apt upgrade -y
  • sudo apt autoremove && sudo apt clean

copy mac public ssh key

  • pbcopy < ~/.ssh/id_rsa.pub

edit host file and flush dns after

@chuckreynolds
chuckreynolds / local-dev-remote-images.php
Created April 3, 2015 06:22
WordPress local dev environment plugin and config to use images from a live server instead of looking on local url path
<?php
/*
* Plugin Name: Local Dev Remote Images
* Description: this will allow a local dev environment to call all images in uploads from a remote server
* Version: 0.1
* License: GPL
* Author: @chuckreynolds
* Author URI: https://chuckreynolds.us
*/
Verifying that +chuckreynolds is my openname (Bitcoin username). https://onename.com/chuckreynolds
@chuckreynolds
chuckreynolds / gist:f53acd21fd01f0420084
Created February 21, 2015 11:22
WordPress function to unregister a taxonomy.
<?php
add_action( 'init', 'unregister_taxonomy_taxname');
function unregister_taxonomy_taxname(){
global $wp_taxonomies;
$taxonomy = 'post_tag'; // tax slug to remove
if ( taxonomy_exists( $taxonomy))
unset( $wp_taxonomies[$taxonomy]);
}