Community Forums › Forums › Archived Forums › Design Tips and Tricks › Transitioning from Prose to Metro Pro: functions.php question
Tagged: genesis hooks, metro-pro theme
- This topic has 2 replies, 2 voices, and was last updated 5 years, 5 months ago by
webmonkey.
-
AuthorPosts
-
October 21, 2019 at 2:32 pm #494148
webmonkey
MemberI am stumped. I am transitioning a site from Prose to Metro Pro.
Using Genesis Simple Hooks and Prose's Custom Code (which appends to its functions.php file), I had removed the author, date and excerpt from category/tag/search archive index pages and moved the title below the thumbnail with the following code.
The code no longer works. I am guessing this is either due to the fact that the newest/current version of Genesis or Prose/Metro Pro themselves do hooks differently.
Any help appreciated with successfully removing from Metro Pro: author, date and excerpt from category/tag/search archive index pages and moving the title below the thumbnail.
Desired effect can be seen here: https://imgur.com/a/j8LrBo9
FROM CUSTOM FUNCTIONS IN PROSE (aka functions.php in Metro Pro)
/** Remove author, date and excerpt from category archives and move title below thumbnail */ add_action( 'genesis_before', 'child_conditional_actions' ); function child_conditional_actions() { if( is_category() || is_home() || is_search() ) { remove_action( 'genesis_before_post_content', 'genesis_post_info' ); remove_action('genesis_post_content', 'genesis_do_post_content'); remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); remove_action( 'genesis_post_title', 'genesis_do_post_title' ); add_action( 'genesis_post_content', 'genesis_do_post_title' ); } if( is_tag() ) { remove_action( 'genesis_before_post_content', 'genesis_post_info' ); remove_action('genesis_post_content', 'genesis_do_post_content'); remove_action( 'genesis_after_post_content', 'genesis_post_meta' ); remove_action( 'genesis_post_title', 'genesis_do_post_title' ); add_action( 'genesis_post_content', 'genesis_do_post_title' ); } }
PRICE/ARTIST NAME ADDED VIA GENESIS SIMPLE HOOKS (Originally added in the genesis_after_post_content Prose hook via Simple Hooks. Looking in Simple Hooks in Metro Pro, this hook does not appear to be present. )
<?php if ( is_archive() || is_front_page() || is_search() ) { if( genesis_get_custom_field( 'gfm-artist' )) echo '<div class="cat_index_custom" width="100">Artist: ' . genesis_get_custom_field( 'gfm-artist' ) .'</div>'; if( genesis_get_custom_field( 'gfm-price' ) && ! in_category( '571' )) echo '<div class="cat_index_custom">Price: <span class="strike">' . genesis_get_custom_field( 'gfm-former-price' ) . '</span> <span class="gfm-price">' . genesis_get_custom_field( 'gfm-price' ) .'</span></div>'; } ?>
I'm therefore guessing that the hooks in Prose/Metro Pro/Genesis need some juggling. Any help appreciated.
October 21, 2019 at 3:07 pm #494149Victor Font
ModeratorThe issue you're running into is that Prose is a legacy XHTML theme. Metro Pro is a HTML5 theme. The latest version of the Genesis Framework no longer supports XHTML themes and all of the legacy code has been removed.
Even if it wasn't removed the old Prose code wouldn't work with Metro Pro. HTML5 themes have different hooks. So no matter what, you would run into this problem.
Look through the code snippets page for the HTML5 hooks that will work for you. https://my.studiopress.com/category/customization/snippets/
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?October 21, 2019 at 8:12 pm #494158webmonkey
MemberOkay, great. That's the page I needed. Thanks Victor.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.