Skip to content

Instantly share code, notes, and snippets.

View chrisdigital's full-sized avatar

Chris C. chrisdigital

View GitHub Profile
@chrisdigital
chrisdigital / Wordpress - Remove theme options of parent in child theme
Last active December 13, 2015 18:08
Sometimes when customizing a commercial Wordpress theme, you want to BLOW UP (remove) the theme options/settings and have your css files do the heavy lifting. Here's how to rip them out via your "child theme setup function."
// Naturally, this is relative to each theme,
// you're going to have to hunt to figure out
// what the items are called in your functions.php
// of parent theme or framework code
// theme prefix = most likely your theme folder name
// Read these threads for context...
// http://wordpress.org/support/topic/overriding-twentyeleven-theme-optionsphp
// http://stackoverflow.com/questions/8994887/how-to-remove-wordpress-theme-options-from-child-theme
// http://codex.wordpress.org/Function_Reference/remove_submenu_page
@chrisdigital
chrisdigital / gist:5428443
Created April 21, 2013 04:05
Disable author page in Wordpress redirect to hp
#
#http://wordpress.stackexchange.com/questions/74924/disable-author-pages-for-specific-users
#
function tst() {
global $wp_query;
if (is_author() && !empty($wp_query->query['author_name'])) {
$author = get_user_by('login',$wp_query->query['author_name']);
if ( 1 === $author->ID) {
wp_safe_redirect(get_bloginfo('url'),'301'); // or whatever you want
}
@chrisdigital
chrisdigital / move WordPress multisite
Created May 1, 2013 05:39
Moving WordPress multisite to a new domain (example shown copies production to development environment.)
//http://wordpress.org/support/topic/transfer-multisite-to-another-server
//http://halfelf.org/2012/moving-wordpress-multisite/
//http://codex.wordpress.org/Moving_WordPress
//http://www.realisingdesigns.com/2010/09/16/moving-the-domain-of-a-wordpress-multisite-install/
UPDATE wp_options SET option_value = replace(option_value, 'www.production.com', 'beta.development.com') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'www.production.com', 'beta.development.com');
UPDATE wp_posts SET post_content = replace(post_content, 'www.production.com', 'beta.development.com');
UPDATE wp_postmeta SET meta_value = replace(meta_value, 'www.production.com', 'beta.development.com');
@chrisdigital
chrisdigital / Overriding selected theme in WordPress
Created May 2, 2013 09:44
Overriding selected theme (open phpMyAdmin) to switch to default to combat server 500 error directly in database for WordPress.
//http://designgala.com/how-to-change-wordpress-theme-directly-from-database/
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'default' WHERE option_name = 'current_theme';
@chrisdigital
chrisdigital / Frontend user profile in WordPress
Created May 6, 2013 13:27
Setting up a editable user profile in WordPress on the frontend.
//How to edit a user profile on the front end?
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end
//Forcing nickname as display_name in custom edit profile template
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template
///////
<?php
# Compiled source #
###################
.pict
.svg
.gif
.jpg
.swf
.fla
.flv
.psd
<?php
//Drop this in your functions.php file in a safe place
//Change all references to "borough" or "Borough" to the taxonomy you need (pay attention to the correct capitalization)
//Then save the edited functions.php
//Find this new filter in: WP Admin > Events > Settings > Filterbar
//Docs for TribeEventsFilter: http://docs.tri.be/Filter-Bar/class-TribeEventsFilter.html
//
//
//This addresses adding/registering the taxonomy to WordPress and the filter functionality to Events Calendar Pro Filter Bar in one shot
//
@chrisdigital
chrisdigital / gist:a1264367998b8582b0d2
Created July 28, 2015 21:54
WordPress : How to find out the current template being used for current page
//http://www.wpinsite.com/code-snippets/how-to-get-the-name-of-the-current-wordpress-page-template
//https://wordpress.org/support/topic/get-name-of-page-template-on-a-page
/**
* Get the name of the current page template name.
* @return string
*/
function get_page_template_name() {
if(is_page()) {
global $post;