This file contains 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 | |
/* | |
Template Name: Blank Page | |
Template By : Jason Resnick | |
URL : http://rezzz.com | |
*/ | |
?> | |
<!DOCTYPE html> | |
<html <?php language_attributes(); ?>> | |
<head> |
This file contains 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
function jr_add_loginout_navitem($items, $args ) { | |
if( $args->theme_location == 'header_nav' ) { | |
if ( !(is_user_logged_in()) ) { | |
$login_item = '<li class="nav-login"><a href="/login">Log In</a></li>'; | |
} | |
else { | |
$login_item = '<li class="nav-login">'.wp_loginout($_SERVER['REQUEST_URI'], false).'</li>'; | |
} | |
$items .= $login_item; | |
} |
This file contains 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
function get_excerpt_by_id($post_id, $n){ | |
$the_post = get_post($post_id); //Gets post ID | |
$the_excerpt = $the_post->post_content; //Gets post_content to be used as a basis for the excerpt | |
$excerpt_length = $n; //Sets excerpt length by word count | |
$the_excerpt = strip_tags(strip_shortcodes($the_excerpt)); //Strips tags and images | |
$words = explode(' ', $the_excerpt, $excerpt_length + 1); | |
if(count($words) > $excerpt_length) : | |
array_pop($words); | |
// array_push($words, '…'); |
This file contains 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 | |
$attractions = get_terms('attraction', array("fields" => "names")); | |
for ( $myterm = 0; $myterm < count($attractions); $myterm++) { ?> | |
<h3><?php echo $attractions[$myterm]; ?>:</h3> | |
<div class="taxonomy_group"> | |
<?php $loop = new WP_Query(array('attraction' => $attractions[$myterm])); | |
while ( $loop->have_posts() ) : $loop->the_post(); | |
get_template_part( 'content', 'things-to-do' ); | |
endwhile; ?> | |
</div> |
This file contains 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
/* | |
Theme Name: <theme name> | |
Theme URI: http://rezzz.com | |
Author: Jason Resnick | |
Author URI: http://rezzz.com/jason-resnick/ | |
Description: A Child theme off of <parent theme> built for the <name of> website | |
Version: 1.0 | |
Template: <parent theme directory name> | |
Text Domain: <name of>-child | |
*/ |
This file contains 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 | |
/* <name of> child theme */ | |
// Faster than @import | |
add_action( 'wp_enqueue_scripts', 'my_child_theme_scripts' ); | |
function my_child_theme_scripts() { | |
wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' ); | |
} |
This file contains 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: Register Helper Example | |
Plugin URI: http://www.paidmembershipspro.com/wp/pmpro-customizations/ | |
Description: Register Helper Initialization Example | |
Version: .1 | |
Author: Stranger Studios | |
Author URI: http://www.strangerstudios.com | |
*/ | |
//we have to put everything in a function called on init, so we are sure Register Helper is loaded |
This file contains 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
#Install PHP CodeSniffer | |
brew install homebrew/php/php-code-sniffer #if using Homebrew | |
git clone https://github.com/squizlabs/PHP_CodeSniffer.git phpcs #if you want to do it directly | |
#Install WordPress Coding Standards | |
git clone -b master https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards.git wpcs | |
#Add WordPress standards to PHPCS config | |
phpcs -i #shows the libraries installed | |
phpcs --config-set installed_paths <path to dir that you cloned>/wpcs |
This file contains 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 | |
/* | |
* Filter Recent Posts based around the categories of the post being displayed | |
*/ | |
function rez_widget_posts_args( $args ) { | |
if ( is_single() ) { // Only want to appear on blog posts. | |
$post = get_queried_object(); | |
$categories = wp_get_post_categories( $post->ID ); | |
$cats = implode( ',',$categories ); |
This file contains 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 | |
/* | |
* Re-order Checkout Fields | |
*/ | |
add_filter( 'woocommerce_checkout_fields', 'rez_move_checkout_fields' ); | |
function rez_move_checkout_fields( $fields ) { | |
$fields2['billing']['billing_email'] = $fields['billing']['billing_email']; |