This file contains hidden or 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
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteCond %{HTTP_HOST} ^olddomain\.com$ [OR] | |
RewriteCond %{HTTP_HOST} ^www\.olddomain\.com$ | |
RewriteRule (.*)$ http://www.newdomain.com/$1 [R=301,L] | |
</IfModule> |
This file contains hidden or 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 | |
/** | |
* WordPress function for redirecting users based on custom user meta | |
*/ | |
function my_login_redirect( $url, $request, $user ){ | |
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) { | |
if( 'cool' == get_user_meta( $user->ID, '_is_cool', true ) ) { | |
$url = home_url('/cool-people-only/'); | |
} |
This file contains hidden or 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
/** | |
* Make bullets a different color without effecting list item text. | |
* Works in all browsers including IE8+ | |
*/ | |
li { | |
list-style-type: none; | |
padding-left: 20px; | |
text-indent: -20px; | |
} | |
li:before { |
This file contains hidden or 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 | |
/** | |
* Plugin Name: Replace WordPress Dashboard | |
* Description: Replaces the default WordPress dashboard with a custom one. | |
* Author: Micah Wood | |
* Author URI: http://micahwood.me | |
* Version: 0.1 | |
* License: GPL3 | |
*/ |
This file contains hidden or 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 | |
add_action( 'wp_enqueue_scripts', 'enqueue_my_styles' ); | |
/** | |
* Example callback function that demonstrates how to properly enqueue conditional stylesheets in WordPress for IE. | |
* IE10 and up does not support conditional comments in standards mode. | |
* | |
* @uses wp_style_add_data() WordPress function to add the conditional data. | |
* @link https://developer.wordpress.org/reference/functions/wp_style_add_data/ |
This file contains hidden or 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
<!--[if lt IE 9]> | |
<link href="style.css" rel="stylesheet" type="text/css"> | |
<![endif]--> |
This file contains hidden or 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 | |
add_action( 'wp_print_styles', 'print_my_styles' ); | |
function print_my_styles() { | |
echo '<!--[if lt IE 9]><link href="style.css" rel="stylesheet" type="text/css"><![endif]-->'; | |
} |
This file contains hidden or 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 reorder_posts( $order = array() ) { | |
global $wpdb; | |
$list = join(', ', $order); | |
$wpdb->query( 'SELECT @i:=-1' ); | |
$result = $wpdb->query( | |
"UPDATE wp_posts SET menu_order = ( @i:= @i+1 ) | |
WHERE ID IN ( $list ) ORDER BY FIELD( ID, $list );" | |
); |
This file contains hidden or 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 | |
/** | |
* Creating a class to handle a WordPress shortcode is overkill in most cases. | |
* However, it is extremely handy when your shortcode requires helper functions. | |
*/ | |
class My_Shortcode { | |
protected | |
$atts = array(), |
This file contains hidden or 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 | |
/** | |
* Installs WordPress for running the tests and loads WordPress and the test libraries | |
*/ | |
error_reporting( E_ALL & ~E_DEPRECATED & ~E_STRICT ); | |
require_once 'PHPUnit/Autoload.php'; | |
$config_file_path = dirname( __FILE__ ) . '/wp-tests-config.php'; |