Last active
October 20, 2016 05:22
-
-
Save meloniq/88d5954a72ec65428ac2e79abc5694f9 to your computer and use it in GitHub Desktop.
[Clipper] Add 'more [store name] coupons text under the description of each coupon, on single coupon page.
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
/** | |
* Adds 'more [store name] coupons' text on singular coupon page. | |
* | |
* @param string $content | |
* | |
* @return string | |
*/ | |
function childtheme_store_more_after_content( $content ) { | |
global $post; | |
if ( ! is_singular( APP_POST_TYPE ) ) { | |
return $content; | |
} | |
$stores = get_the_term_list( $post->ID, APP_TAX_STORE, ' ', ', ', '' ); | |
$see_more = sprintf( __( 'More %s Coupons', APP_TD ), $stores ); | |
$see_more = html( 'p', $see_more ); | |
return $content . $see_more; | |
} | |
add_filter( 'the_content', 'childtheme_store_more_after_content', 10, 1 ); | |
/** | |
* Adds 'more [store name] coupons' text on pages with lists of coupons. | |
* | |
* @return void | |
*/ | |
function childtheme_store_more_after_excerpt() { | |
global $post; | |
if ( is_singular( APP_POST_TYPE ) || ! in_the_loop() ) { | |
return; | |
} | |
if ( $post->post_type != APP_POST_TYPE ) { | |
return; | |
} | |
$stores = get_the_term_list( $post->ID, APP_TAX_STORE, ' ', ', ', '' ); | |
$see_more = sprintf( __( 'More %s Coupons', APP_TD ), $stores ); | |
echo html( 'p', $see_more ); | |
} | |
add_action( 'appthemes_after_post_content', 'childtheme_store_more_after_excerpt', 10 ); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment