Last active
February 8, 2017 18:08
-
-
Save rickalday/25fa8a6829d949e97efadcc2f5fdd399 to your computer and use it in GitHub Desktop.
Filter for custom message for print or downloads
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 = ''; | |
if ( is_main_query() && is_singular( 'sell_media_item' ) && ! sell_media_has_multiple_attachments( $post_id ) || sell_media_attachment( $post_id ) ) { | |
if ( 'reprint' == $meta ) { | |
//Edit the next line with a custom message or HTML code for print products. | |
//Leave only the quotes if you don't want to add a custom message. | |
//For example $new_content .= ''; | |
$content .= '<div class="item-description">Custom text for print products</div>'; | |
} else { | |
//Edit the next line with a custom message or HTML code for downloadable products. | |
//Leave only the quotes if you don't want to add a custom message. | |
//For example $new_content .= ''; | |
$content .= '<div class="item-description">Custom text for downloads</div>'; | |
} | |
} | |
return $content; | |
} | |
add_filter( 'the_content', 'my_sell_media_content_loop', 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment