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
/** | |
* Resize an image to the specified dimensions | |
* http://codex.wordpress.org/Class_Reference/WP_Image_Editor | |
* | |
* Returns the new image file path | |
* | |
* @param image_url | |
* @param width | |
* @param width | |
* @return resized image file path |
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_post_siblings( $limit = 1, $date = '' ) { | |
global $wpdb, $post; | |
if( empty( $date ) ) | |
$date = $post->post_date; | |
//$date = '2009-06-20 12:00:00'; // test data | |
$limit = absint( $limit ); | |
if( !$limit ) |
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
//Returns the Sell Media Item post title | |
function sell_media_custom_view_text(){ | |
global $post; | |
$title = get_the_title( $post->ID ); | |
return $title; | |
} | |
add_filter( 'sell_media_view_gallery_text', 'sell_media_custom_view_text' ); |
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
//My custom Sell Media Loop | |
function my_sell_media_content_loop( $post_id, $i ){ | |
$class = apply_filters( 'sell_media_grid_item_class', 'sell-media-grid-item', $post_id ); | |
if ( ! sell_media_has_multiple_attachments( $post_id ) ) | |
$class .= ' sell-media-grid-single-item'; | |
$html = '<div id="sell-media-' . $post_id . '" class="' . $class . '">'; | |
$parent = false; | |
if( !is_archive() ){ | |
// if there is a post parent, change link to gallery | |
$parent = sell_media_attachment_parent_post( $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
//Returns the Sell Media Item post title | |
function sell_media_custom_quick_view_text(){ | |
global $post; | |
$title = get_the_title( $post->ID ); | |
return $title; | |
} | |
add_filter( 'sell_media_quick_view_text', 'sell_media_custom_quick_view_text' ); |
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
// Return an alternate title, without prefix, for every type used in the get_the_archive_title(). | |
add_filter('get_the_archive_title', function ($title) { | |
if ( is_category() ) { | |
$title = single_cat_title( '', false ); | |
} elseif ( is_tag() ) { | |
$title = single_tag_title( '', false ); | |
} elseif ( is_author() ) { | |
$title = '<span class="vcard">' . get_the_author() . '</span>'; | |
} elseif ( is_year() ) { | |
$title = get_the_date( _x( 'Y', 'yearly archives date format' ) ); |
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 my_sell_media_content_loop( $content ) { | |
global $post; | |
$post_id = $post->ID; | |
$parent_id = sell_media_get_attachment_parent_id( $post_id ); | |
$post_id = ( '' === $parent_id ) ? $post_id : $parent_id; | |
$meta = get_post_meta( $post_id, '_sell_media_reprints_sell', true ); | |
$message = ''; |
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 sell_media_custom_tos_text(){ | |
return 'By clicking "Checkout Now", you are agreeing to our <a href="custom link here">terms of service</a>.'; | |
} | |
add_filter( 'sell_media_tos_label', 'sell_media_custom_tos_text' ); |
OlderNewer