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
| /** | |
| * Change login logo | |
| * Max image width should be 320px | |
| * @link http://andrew.hedges.name/experiments/aspect_ratio/ | |
| */ | |
| add_action('login_head', 'rgt_custom_dashboard_logo'); | |
| function rgt_custom_dashboard_logo() { | |
| echo '<style type="text/css"> | |
| .login h1 a { | |
| background-image:url('.get_stylesheet_directory_uri().'/images/logo.png) !important; |
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 | |
| //* Replace the standard loop with our custom loop | |
| //* props to David Wang, he is the man! | |
| // @author David Wang | |
| // @link http://genesissnippets.com/genesis-custom-loop/ | |
| remove_action( 'genesis_loop', 'genesis_do_loop' ); | |
| add_action( 'genesis_loop', 'child_do_custom_loop' ); | |
| function child_do_custom_loop() { |
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
| // Set the number of posts per page | |
| add_filter( 'pre_get_posts', 'be_archive_query' ); | |
| // @link http://www.billerickson.net/customize-the-wordpress-query/ | |
| function be_archive_query( $query ) { | |
| if( $query->is_main_query() && $query->is_archive() ) { | |
| $query->set( 'posts_per_page', 12 ); | |
| } | |
| } | |
| // OR |
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
| /** | |
| * Breaks the posts into 4 columns | |
| * @link http://www.billerickson.net/code/grid-loop-using-post-class | |
| */ | |
| add_filter( 'post_class', 'tsm_archive_post_class' ); | |
| function tsm_archive_post_class( $classes ) { | |
| global $wp_query; | |
| // Keeps columns out of secondary loops ie: Genesis Featured Post widgets | |
| if( ! $wp_query->is_main_query() ) { | |
| return $classes; |
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
| // Remove titles from pages only | |
| add_action('get_header', 'child_remove_page_titles'); | |
| function child_remove_page_titles() { | |
| $pages=array(); | |
| if (is_page($pages)) { | |
| remove_action('genesis_entry_header', 'genesis_do_post_title'); | |
| } | |
| } |
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 | |
| /** | |
| * Lightens/darkens a given colour (hex format), returning the altered colour in hex format.7 | |
| * @param str $hex Colour as hexadecimal (with or without hash); | |
| * @percent float $percent Decimal ( 0.2 = lighten by 20%(), -0.4 = darken by 40%() ) | |
| * @return str Lightened/Darkend colour as hexadecimal (with hash); | |
| */ | |
| function color_luminance( $hex, $percent ) { | |
| // validate hex string |
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
| function is_tree( $pid ) { // $pid = The ID of the page we're looking for pages underneath | |
| global $post; // load details about this page | |
| if ( is_page($pid) ) | |
| return true; // we're at the page or at a sub page | |
| $anc = get_post_ancestors( $post->ID ); | |
| foreach ( $anc as $ancestor ) { | |
| if( is_page() && $ancestor == $pid ) { | |
| return true; |
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 strpos_array($haystack, $needles, $offset = 0) { | |
| if (is_array($needles)) { | |
| foreach ($needles as $needle) { | |
| $pos = strpos_array($haystack, $needle); | |
| if ($pos !== false) { | |
| return $pos; | |
| } | |
| } | |
| return false; |
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
| // This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
| <?php | |
| /** | |
| * WordPress Query Comprehensive Reference | |
| * Compiled by luetkemj - luetkemj.github.io | |
| * | |
| * CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
| * Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
| */ |
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 | |
| /** | |
| * keeps a user always logged in | |
| * don't use this on a production site, ever! | |
| */ | |
| add_action('init', 'auto_login'); | |
| add_action('admin_init', 'auto_login'); | |
| function auto_login() { |