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
/** | |
* Detect Scroll. | |
* | |
* Detect scroll distance from top and/or bottom and scroll up and down. | |
*/ | |
( function( $ ) { | |
var lastScrollTop = 0, delta = 20; | |
$(window).scroll(function(){ |
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 genius_add_search_toggle ( $items, $args ) { | |
if ( $args->theme_location == 'social') { | |
$items .= '<li id="search-toggle" class="menu-item"><a href="#"><span class="screen-reader-text">Search Toggle</span></a></li>'; | |
} | |
return $items; | |
} | |
add_filter( 'wp_nav_menu_items', 'genius_add_search_toggle', 10, 2 ); |
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
/** | |
* Turn a multi-dimensional array in to a simple flat array. | |
* | |
* @link http://stackoverflow.com/a/14972714/4429450 | |
*/ | |
function array_flatten($array) { | |
$return = array(); | |
foreach ($array as $key => $value) { | |
if (is_array($value)){ $return = array_merge($return, array_flatten($value));} | |
else {$return[$key] = $value;} |
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 ( ! function_exists( 'genius_portfolio_url' ) ) : | |
/** | |
* Echo a read more url for the portfolio page if the total posts is higher dan the displayed posts. | |
*/ | |
function genius_portfolio_url() { | |
// Return if the post limit is more than total posts. | |
$post_limit = get_theme_mod( 'genius_portfolio_limit', 9 ); | |
$total_posts = wp_count_posts( 'jetpack-portfolio' )->publish; | |
if ( $post_limit > $total_posts ) { |
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 ( ! function_exists( 'magnumopus_featured_image' ) ) : | |
/** | |
* Displays a featured image at the top of single posts and pages and pages with a portfolio or front page template. | |
* | |
* @since Magnum_Opus 1.0.0 | |
*/ | |
function magnumopus_featured_image() { | |
// Return if it's not home and there is no featured image. | |
if ( ! is_home() && ! has_post_thumbnail() ) { | |
return; |
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 empty <p> tags. | |
* | |
* See: http://stackoverflow.com/questions/27781798/wordpress-retain-formatting-when-calling-extended-content#comment43990361_27782619 | |
* This seems to be the easiest solution. Remove this function if this ever gets fixed. | |
* Credits: http://stackoverflow.com/questions/6092855/how-do-i-remove-empty-p-tags-with-jquery | |
*/ | |
( function( $ ) { | |
$( 'p' ).each( function() { |
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
// Add .large class to the <p> parent of images wider than 680px. | |
$( '.entry-content img' ).each( function() { | |
var $this = $( this ); | |
if ( ( $this.attr( 'width' ) > 680 ) && ( $this.parent().is( 'p' ) ) ) { | |
$this.parent().addClass( 'large' ); | |
} | |
}); |
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 | |
/** | |
* Set the content width in pixels, based on the theme's design and stylesheet. | |
* | |
* Priority 0 to make it available to lower priority callbacks. | |
* | |
* @global int $content_width | |
*/ | |
function bookmark_content_width() { | |
$GLOBALS['content_width'] = apply_filters( 'bookmark_content_width', 800 ); |
OlderNewer