The following code will enable you to display featured images directly after post titles.
To get started, all you need to do is copy/paste the following code to your child theme’s function file (functions.php). You will also need to install a custom CSS plugin if you are uncomfortable playing around with your theme’s stylesheet.
Add and Center Featured Post Images
Open your theme’s functions.php file and paste the code below:
//* Add featured Image add_action( 'genesis_entry_header', 'single_post_featured_image', 15 ); function single_post_featured_image() { if ( ! is_singular( 'post' ) ) return; $img = genesis_get_image( array( 'format' => 'html', 'size' => genesis_get_option( 'image_size' ), 'attr' => array( 'class' => 'entry-image' ) ) ); printf( '<div class="featuredimg"><a href="%s" title="%s">%s</a></div>', get_permalink(), the_title_attribute( 'echo=0' ), $img ); }
Then add this to your CSS file or custom CSS plugin:
/* Center Featured Images Genesis */ .featuredimg { text-align:center; margin-bottom: 14px;}
Other Simple Genesis Tips
Customise Footer – Add Custom Text
This will change the copyright text located on the footer of your website.
//* Customize the entire footer remove_action('genesis_footer', 'genesis_do_footer'); add_action('genesis_footer', 'sp_custom_footer'); function sp_custom_footer() { ?> ©Copyright 2018 My Website Name· All Rights Reserved· }
Override Body Classes – Remove classes from body_class
//* Add body class add_filter('body_class', 'my_body_class', 10, 2); function my_body_class($wp_classes, $extra_classes) { // List of the only WP generated classes allowed $whitelist = array('custom-body-class-1', 'custom-body-class-2', 'blog-body-class-1'); // Filter the body classes $wp_classes = array_intersect($wp_classes, $whitelist); // Add the extra classes back untouched return array_merge($wp_classes, (array) $extra_classes); }
The code above not working? Contact Us
Useful Links
There are other great code snippets you can use over at: