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 | |
/** | |
* Given an attachment_id and a definition of panoramia, detect if a photo is panoramic | |
* | |
* @param int $attachment_id the attachment_id for the image | |
* @param mixed $min_ratio the aspect ratio that defines panoramia | |
* @return boolean returns true if image is panoramic, otherwise returns false | |
*/ | |
function sjf_deh_is_pano( $attachment_id, $min_ratio='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
<?php | |
/** | |
* Alter the main query to grab posts of the attachment type | |
* | |
* @param object $query The WP_Query for the current page view | |
*/ | |
function sjf_deh_alter_main_query( $query ) { | |
// we don't want to alter the query in wp-admin | |
if ( is_admin() ) { 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
<?php | |
/** | |
* Returns a block of CSS for displaying and positioning a full-page background image | |
* | |
* @return string|bool A block of CSS for displaying and positioning a full-page background image or false on failure | |
*/ | |
function sjf_deh_the_bg_image_styles(){ | |
// this function won't work if $post is not set (which would be the case on a 404 page, for example) | |
$post = get_post(); |
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
alert('hello world'); |
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 | |
/** | |
* Get the current post featured image, with a call to wp_is_mobile to grab a smaller size for mobile users. | |
* | |
* This function uses wp_is_mobile(), which is not intended for public use on the front end -- buyer beware. | |
* @return string|bool Returns the src for the featured image, or false on failure | |
*/ | |
function sjf_deh_get_image_src(){ | |
// $post must work in order to grab the featured image |
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 sjf_def_og_image(){ | |
echo' | |
<meta property="og:image" content="'.sjf_deh_get_image_src().'" /> | |
'; | |
} | |
add_action('wp_head', 'sjf_def_og_image'); |
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 the Meta Box to attachments | |
*/ | |
function sjf_deh_add_custom_meta_box() { | |
add_meta_box( | |
'custom_meta_box', // id | |
'Art Direction', // title | |
'sjf_deh_show_custom_meta_box', // callback |
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 | |
/** | |
* Return a multi-dimensional array for managing custom post meta | |
* | |
* @return array An multi-dimensional associative array for drawing & saving post meta fields. | |
*/ | |
function sjf_deh_meta_fields() { | |
$sjf_deh_meta_fields = 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 | |
/** | |
* Draw a custom meta box for attachments | |
*/ | |
function sjf_deh_show_custom_meta_box() { | |
// affect the current post | |
global $post; | |
OlderNewer