Community Forums › Forums › Archived Forums › Design Tips and Tricks › Infinity Pro – Exclude "Team Member" Page from Displaying Full Width Image
Tagged: Infinity Pro, team template
- This topic has 7 replies, 3 voices, and was last updated 4 years, 7 months ago by
rshill65.
-
AuthorPosts
-
October 20, 2018 at 8:45 pm #223884
rshill65
ParticipantI edited the Infinity Pro theme to include a full width image above the page content using a tutorial by Ben Weiser.
https://benweiser.com/how-to-add-a-full-width-image-above-page-content-in-genesis/
Here is my problem. As great as this edit is, the Team Member template also uses the "Featured Image" thumbnail to display the Team Page Grid, but unfortunately the featured image thumbnail also displays as a full width image above the page content.
Example Page: http://www.infinitemindpublishing.com/proofs/STI/about-us/steel-tower-team/elizabeth-urish-walton/
Here is the code I used. I need to find a way to exclude the post thumbnail from the Team page template.
//Add hero image above post/page content
// Create new image size for our hero image
add_image_size( 'hero-image', 1600, 660, TRUE ); // creates a hero image size// Hook after header area
add_action( 'genesis_after_header', 'bw_hero_image' );function bw_hero_image() {
// If it is a page and has a featured thumbnail, but is not the front page do the following...
if (has_post_thumbnail() && is_page() ) {
// Get hero image and save in variable called $background
$image_desktop = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'hero-image' );
$image_tablet = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'large' );
$image_mobile = wp_get_attachment_image_src( get_post_thumbnail_id( $page->ID ), 'medium' );$bgdesktop = $image_desktop[0];
$bgtablet = $image_tablet[0];
$bgmobile = $image_mobile[0];// You can change above-post-hero to any class you want and adjust CSS styles
$featured_class = 'above-post-hero';I hope this makes sense.
Thank you.
http://www.infinitemindpublishing.com/proofs/STI/October 20, 2018 at 9:44 pm #223886rshill65
ParticipantI did get the full width featured image to go away using display: none; in my CSS file, but I would honestly like a more elegant solution.
I am thinking about trying to generate a second "Featured Image" thumbnail. I could call it "Above Content" thumbnail and use that instead.
October 21, 2018 at 4:46 am #223890andytc
ParticipantI can tell you the reason it's appearing above the content - in the code , it's this bit -
// Hook after header area add_action( 'genesis_after_header', 'bw_hero_image' );
You could try shifting it around by changing the hook. One example below -
// Hook after header area add_action( 'genesis_before_entry', 'bw_hero_image' );
You can view page hooks here visually -
https://genesistutorials.com/visual-hook-guide/sample/
also to note , that code is adding the image as a 'Background' not an inline image.
October 21, 2018 at 8:30 am #223896Brad Dalton
ParticipantYou can use conditional tags to exclude/include page types. https://codex.wordpress.org/Conditional_Tags#A_PAGE_Page
Your code uses is_page.
This should be changed to something like, is_singular('page')
Or
Something like ! is_page_template('slug') where slug is the name of your template
October 21, 2018 at 2:45 pm #223899rshill65
ParticipantThank you for your reply. I understand why it is showing up, but I also needed to exclude the Featured Image thumbnail from the Team Pages.
October 21, 2018 at 2:47 pm #223900rshill65
ParticipantThank you Brad Dalton that is helpful to know.
October 22, 2018 at 2:18 am #223904Brad Dalton
ParticipantThats another question. Please start another topic for your 2nd question.
October 22, 2018 at 9:56 am #223911rshill65
Participantsure thing
-
AuthorPosts
- The topic ‘Infinity Pro – Exclude "Team Member" Page from Displaying Full Width Image’ is closed to new replies.