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
/** | |
* Get the number of meta for a specific Post ID | |
* | |
* @since 1.0.0 | |
* | |
* @param integer $post_id Post ID to query for | |
* @return integer Returns the count number | |
*/ | |
function tonya_get_meta_count_for_post_id( $post_id ) { |
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 | |
/** | |
* Restrict Media Library by User Role | |
* | |
* @package Restrict_Media_Library | |
* @since 1.0.0 | |
* @author hellofromTonya | |
*/ | |
/** |
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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
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 | |
/** | |
* As part of our weekly challenges, take a crack at this one. | |
* To play along, | |
* 1. Copy the code into a Gist, | |
* 2. Answer each of the questions by supplying the code; | |
* 3. Provide some notes as to your train of thought; | |
* 4. Then submit the gist's URL for us to review. | |
* |
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 | |
/** | |
* Fetch user meta for the specified role and return user ID, first name, and last name | |
* | |
* @since 1.0.0 | |
* | |
* @param string $role | |
* @return array | |
*/ |
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 ( document, $, undefined ) { | |
/***** | |
* SHOWING HOISTING WITH A VARIABLE | |
*/ | |
// Let me show hoisting to you by demonstrating a variable and it's | |
// initialization with a value | |
// 1. You get "undefined" here - but NOT an error. | |
console.log( hoistingVariable ); | |
var hoistingVariable = 'I am initializing it now.'; |
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 | |
namespace KnowTheCode; | |
add_filter( 'authenticate', __NAMESPACE__ . '\enable_login_with_email', 20, 3 ); | |
/** | |
* Allow the user to log in via email address. | |
* | |
* If the `$email_or_username` parameter is not an email, then bail out, returning the `$user`. | |
* Otherwise, get the user's object via the email. Then reauthenticate their login | |
* via `wp_authenticate_username_password`. |
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 genesis_header_body_classes( array $classes ) { | |
if ( current_theme_supports( 'custom-header' ) ) { | |
if ( get_theme_support( 'custom-header', 'default-text-color' ) !== get_header_textcolor() || get_theme_support( 'custom-header', 'default-image' ) !== get_header_image() ) | |
$classes[] = 'custom-header'; | |
} | |
if ( 'image' === genesis_get_option( 'blog_title' ) || ( get_header_image() && ! display_header_text() ) ) | |
$classes[] = 'header-image'; |
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 genesis_do_post_image() { | |
/** | |
* Return Early Pattern opportunity | |
* ================================ | |
* Notice that the code wrapped in this conditional block only executes IF the | |
* conditional expression is true. Hum, that means if the conditional expression | |
* is false, then the function is done and nothing else is going to happen. | |
*/ | |
if ( ! is_singular() && genesis_get_option( 'content_archive_thumbnail' ) ) { |
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 genesis_do_post_image() { | |
if ( is_singular() || ! genesis_get_option( 'content_archive_thumbnail' ) ) { | |
return; | |
} | |
$img = genesis_get_image( array( | |
'format' => 'html', | |
'size' => genesis_get_option( 'image_size' ), | |
'context' => 'archive', |