About Sridhar Katakam
I am an independent WordPress web consultant with 10 years of experience in WordPress theme installation, customization, administration, maintenance, support, documentation, troubleshooting and PSD/design to WP.
Genesis and WordPress Tutorials
Session expired
Please log in again. The login page will open in a new tab. After logging in you can close it and return to this page.
Another great easy to follow guide – you really are the best for Genesis. This works perfectly – but I would also like to add a text block on the image. I can use this code seen here inside a page/post and works fine but can’t get this working inside the function – have tried adding the h2 in all different places in the function – text always shows on page but cant get this on the image in a block…any thoughts – cheers
http://css-tricks.com/text-blocks-over-image/
Testing with this code
A Movie in the Park:
Kung Fu Panda
Hi. Just wondering if there is a way to display this on the homepage only? Please note, my site is on a redirect to the current website. Thanks for your help.
Hello Sirdhar, i cannot display an image. It only shows the site title where the image has to appear. Maybe the name of my image is wrong. http://dannyfroese.nachfolgen.de/wp-content/uploads/sites/5/2014/08/header.jpg Can you help?
Sorry, it was my mistake. I solved the problem. Please delete my comment.
Hey Sridhar, i really would like to have the image only on the front page. is there a way to get this function working? Because now my readers have to scroll down anytime the click a link in post excerpt to get to the content.
Thanks a lot.
How if I want to remove the home page url from the image? And how if I want to hide this image in certain page?
How would I apply this to the ‘events’ slug that The Events Calendar Pro plugin creates per the default page template. I tried adding this; but no luck :/
//* Display Featured image after header
function bl_featured_image() {
if ( has_post_thumbnail() && ( is_page() ) && 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(
”,
esc_url( $image ),
$alt
);
}
//* Load custom products script only on events page
if ( is_page( ‘events’) ) {
// Display featured image
printif(
”
);
}
}
Couple of people have asked about making this image just on home page. I would be interested in that too. many thanks
Change the code to be added in functions.php to this:
[php]// Display image below header
add_action ( ‘genesis_after_header’, ‘sk_add_header_image’, 9 );
function sk_add_header_image() {
if ( !is_front_page() ) {
return;
}
echo ‘<div class="my-header-image">’;
$header_image = sprintf( ‘<a href="%s" title="%s"><img src="’. get_stylesheet_directory_uri() .’/images/header.jpg" title="%s" alt="%s"/></a>’, trailingslashit( home_url() ), esc_attr( get_bloginfo( ‘name’ ) ), esc_attr( get_bloginfo( ‘name’ ) ), esc_attr( get_bloginfo( ‘name’ ) ) );
echo $header_image;
echo ‘</div>’;
}[/php]