Genesis - modify main loop title only
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
<?php | |
add_filter( 'genesis_post_title_text', 'child_modify_title' ); | |
/** | |
* Add price to post title when category is 'current stock' | |
* | |
* This will only show the price on "main loop" | |
* | |
* @param string $title, post title text, as per genesis_do_post_title() | |
* @return string $title, modified title | |
*/ | |
function child_modify_title( $title ) { | |
if( in_category( 'shop-news' ) ) { | |
global $post; | |
$price = get_post_meta( $post->ID, 'Prijs', true ); | |
$title = $title . ' ~ €' . $price; | |
} | |
return $title; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment