Community Forums › Forums › Archived Forums › Design Tips and Tricks › Ass full width image before Events Calendar html output via genesis hook
Tagged: the events calendar
- This topic has 2 replies, 2 voices, and was last updated 8 years, 1 month ago by bisonbrah.
-
AuthorPosts
-
March 1, 2016 at 12:26 pm #180353bisonbrahParticipant
Really need some help adding full width image to the slug 'events' created by The Events Calendar plugin I've added the follow to my functions.php to output a full width after_header image on single pages.
add_action ( 'genesis_after_header', 'bl_featured_image', 9 ); //* Display Featured image after header function bl_featured_image() { if ( has_post_thumbnail() && ( is_page() || is_single() ) && 0 === get_query_var( 'page' ) ) { // Get the URL of featured image $image = genesis_get_image( 'format=url' ); // Get the alt text of featured image $thumb_id = get_post_thumbnail_id( get_the_ID() ); $alt = get_post_meta( $thumb_id, '_wp_attachment_image_alt', true ); // If no alt text is present for featured image, set it to Post/Page title if ( '' == $alt ) { $alt = the_title_attribute( 'echo=0' ); } // Display featured image printf( '<div class="my-featured-image"><img src="%s" alt="%s" class="aligncenter" /></div>', esc_url( $image ), $alt ); } }
I have tried adding the following into the default-template.php (events calendar template) in my child theme directory per their input; and still no luck.
Resources:
Events Calendar & Genesis Docs
Events Calendar Themeing Guideadd_action ( 'genesis_after_header', 'bl_featured_image', 9 ); function add_month_view_header_img( printf ) { if ( ! tribe_is_month() ) return printf; // Display featured image printf( '<div class="my-featured-image"><img src="http://block.wpengine.com/wp-content/uploads/events-text.jpg" alt="Events Banner" class="aligncenter" /></div>', esc_url( $image ), $alt ); }
Can anyone assist me with adding the full width header image hooked into the 'genesis_after_header' location?
http://block.wpengine.com/events/March 1, 2016 at 3:02 pm #180374WhiteleyDesignsMemberHey bisonbrah,
I have a site I built that is a heavily customized version of The Events Calendar and it is built-on Genesis (https://pondhole.com/) and the homepage customization was done to the default-template.php. Per their documentation I added it to my child theme in new directory called 'tribe-events'. I also had to wrap any code that I wanted only on the home page in:
<?php if( !is_single() ) : ?>
... to ensure it only showed on the home page.
Note - I also use the Event Rocket plugin to allow me to make the event page the home page (https://wordpress.org/plugins/event-rocket/) so my setup may differ from yours.
Hope this provides some help. The Events Calendar can be pretty tough to work with, but their support is absolutely spectacular so I would suggest getting on the forums there for some guidance. In my experience they offer one of, if not the best support out there.
Good luck!
Matt
Matt Whiteley – WhiteleyDesigns, GitHub
Designing, Developing & Creating with WordPressMarch 1, 2016 at 3:05 pm #180375bisonbrahParticipantThanks for the input Matt. Would you mind providing a code snippet for reference?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.