Community Forums › Forums › Archived Forums › General Discussion › Need to put blog posts back onto home page of Education child theme
Tagged: education, genesis_loop, home page
- This topic has 7 replies, 3 voices, and was last updated 6 years, 12 months ago by dsvakola.
-
AuthorPosts
-
July 12, 2017 at 2:33 pm #209034BonnieMember
Our nonprofit installed the Education theme years ago. Our board loves it as it is... except: they want to add the blog posts back to the home page.
I removed the the blog posts years ago by adding this code to the bottom of the child theme's home.php page:
// Replaces homepage blog posts remove_action( 'genesis_loop', 'genesis_do_loop' ); genesis();
...At least, I thought that's all I did to remove the blog posts from the page. When I remove those lines I get a blank home page, so there is obviously something else I need to adjust.
I found this article: https://www.billerickson.net/dont-use-genesis-blog-template/ and I realize we need to update the child theme because now home.php is front-page.php, but I'm on a deadline right now and just need to get the blog posts added to the bottom of the home page, quickly, if possible!
So... what else do I need to do?
Thanks for your help!
http://sdafoundation.com/July 12, 2017 at 4:59 pm #209039Brad DaltonParticipantJuly 13, 2017 at 11:08 am #209067BonnieMemberThanks, Brad, for the response. I removed...
// Replaces homepage blog posts remove_action( 'genesis_loop', 'genesis_do_loop' );
....and left this behind...
genesis();
And now do not get a blank page or error messages, so I am closer to what I need. However, the blog posts still do not appear on my home page.
I've
- made sure my "Front page displays Your latest posts" setting is checked
- made sure my custom css doesn't hide blog posts
- searched my functions.php, but as I'm a little weak on the PHP side I'm not sure what else might be missing
I would compare my functions.php and home.php files with the original Education (non-pro) file, but I don't have a copy of the originals, only the edited ones. My bad!
Perhaps this will help? Here is what is in my child theme's home.php file:
<?php add_action( 'genesis_meta', 'education_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function education_home_genesis_meta() { global $paged; if( $paged < 1 ) { if ( is_active_sidebar( 'slider' ) || is_active_sidebar( 'intro' ) || is_active_sidebar( 'featured' ) || is_active_sidebar( 'call-to-action' ) ) { add_action( 'genesis_before_content', 'education_home_loop_helper', 1 ); } } } function education_home_loop_helper() { echo '<div id="home-featured">'; genesis_widget_area( 'slider', array( 'before' => '<div class="slider widget-area">' ) ); genesis_widget_area( 'intro', array( 'before' => '<div class="intro widget-area"><div class="inner">', 'after' => '<div class="clear"></div></div></div><!-- end .intro -->' ) ); genesis_widget_area( 'call-to-action', array( 'before' => '<div class="call-to-action"><div class="banner-left"></div>', 'after' => '<div class="banner-right"></div></div><!-- end .call-to-action -->' ) ); genesis_widget_area( 'featured', array( 'before' => '<div class="featured widget-area"><div class="inner">', 'after' => '<div class="clear"></div></div></div><!-- end .featured -->' ) ); echo '</div>'; } genesis();
... and here is what is I have in the functions.php file:
<?php /** Start the engine */ include_once( get_template_directory() . '/lib/init.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'education', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'education' ) ); /** Child theme (do not remove) */ define( 'CHILD_THEME_NAME', 'Education Theme' ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/education' ); /** Create additional color style options */ add_theme_support( 'genesis-style-selector', array( 'education-black' => __( 'Black' , 'education' ), 'education-green' => __( 'Green' , 'education' ), 'education-purple' => __( 'Purple' , 'education' ), 'education-red' => __( 'Red' , 'education' ), 'education-navy' => __( 'Navy' , 'education' ), 'education-teal' => __( 'Teal' , 'education' ) ) ); add_action( 'genesis_meta', 'education_add_viewport_meta_tag' ); /** Add Viewport meta tag for mobile browsers */ function education_add_viewport_meta_tag() { echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'; } function display_category_archives_description () { if (is_category() ) { echo category_description( $category-id ); }} add_action( 'genesis_before_loop', 'display_category_archives_description'); /** * @author Brad Dalton - WP Sites * * @link http://wpsites.net/web-design/display-image-on-all-category-pages/ */ /** Add new image sizes */ add_image_size( 'featured-image', 150, 100, TRUE ); /** Add structural wraps */ add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) ); /** Add support for custom background */ add_theme_support( 'custom-background', array( 'default-image' => get_stylesheet_directory_uri() . '/images/bg.png', 'default-color' => 'f5f5f5', ) ); /** Add support for custom header */ add_theme_support( 'custom-header', array( 'width' => 380, 'height' => 100, 'header-selector' => '#title a', 'header-text' => false ) ); /** Add support for 3-column footer widgets */ add_theme_support( 'genesis-footer-widgets', 3 ); /** Reposition Primary Navigation */ remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' ); /** Reposition Secondary Navigation */ remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_subnav' ); /** Reposition Breadcrumbs */ remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); add_action( 'genesis_before_content', 'genesis_do_breadcrumbs' ); add_filter( 'genesis_comment_list_args', 'child_comment_list_args' ); /** Change avatar size */ function child_comment_list_args( $args ) { $args = array( 'type' => 'comment', 'avatar_size' => 33, 'callback' => 'genesis_comment_callback' ); return $args; } /** Register widget areas */ genesis_register_sidebar( array( 'id' => 'slider', 'name' => __( 'Slider', 'education' ), 'description' => __( 'This is the slider section.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'intro', 'name' => __( 'Intro', 'education' ), 'description' => __( 'This is the intro section displayed below the slider.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'featured', 'name' => __( 'Featured', 'education' ), 'description' => __( 'This is the featured section displayed below the intro.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'call-to-action', 'name' => __( 'Call To Action', 'education' ), 'description' => __( 'This is the call to action banner.', 'education' ), ) );
Also, I wanted to note that I removed the "education pro" tag from this post because this is NOT Education Pro. I am using Pro on a subdirectory site (and have been for years) but this site in the root of the domain is the "Education Child Theme."
July 13, 2017 at 11:14 am #209069BonnieMemberI hit submit on my reply, but it doesn't show and the index says there are only 2 posts here. So I'm resubmitting... if this is a duplicate, I'm sorry!
Thanks, Brad, for the response. I removed...// Replaces homepage blog posts remove_action( 'genesis_loop', 'genesis_do_loop' );
....and left this behind...
genesis();
And now do not get a blank page or error messages, so I am closer to what I need. However, the blog posts still do not appear on my home page.
I've
- made sure my "Front page displays Your latest posts" setting is checked
- made sure my custom css doesn't hide blog posts
- searched my functions.php, but as I'm a little weak on the PHP side I'm not sure what else might be missing
I would compare my functions.php and home.php files with the original Education (non-pro) file, but I don't have a copy of the originals, only the edited ones. My bad!
Perhaps this will help? Here is what is in my child theme's home.php file:
<?php add_action( 'genesis_meta', 'education_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function education_home_genesis_meta() { global $paged; if( $paged < 1 ) { if ( is_active_sidebar( 'slider' ) || is_active_sidebar( 'intro' ) || is_active_sidebar( 'featured' ) || is_active_sidebar( 'call-to-action' ) ) { add_action( 'genesis_before_content', 'education_home_loop_helper', 1 ); } } } function education_home_loop_helper() { echo '<div id="home-featured">'; genesis_widget_area( 'slider', array( 'before' => '<div class="slider widget-area">' ) ); genesis_widget_area( 'intro', array( 'before' => '<div class="intro widget-area"><div class="inner">', 'after' => '<div class="clear"></div></div></div><!-- end .intro -->' ) ); genesis_widget_area( 'call-to-action', array( 'before' => '<div class="call-to-action"><div class="banner-left"></div>', 'after' => '<div class="banner-right"></div></div><!-- end .call-to-action -->' ) ); genesis_widget_area( 'featured', array( 'before' => '<div class="featured widget-area"><div class="inner">', 'after' => '<div class="clear"></div></div></div><!-- end .featured -->' ) ); echo '</div>'; } genesis();
... and here is what is I have in the functions.php file:
<?php /** Start the engine */ include_once( get_template_directory() . '/lib/init.php' ); //* Set Localization (do not remove) load_child_theme_textdomain( 'education', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'education' ) ); /** Child theme (do not remove) */ define( 'CHILD_THEME_NAME', 'Education Theme' ); define( 'CHILD_THEME_URL', 'http://my.studiopress.com/themes/education' ); /** Create additional color style options */ add_theme_support( 'genesis-style-selector', array( 'education-black' => __( 'Black' , 'education' ), 'education-green' => __( 'Green' , 'education' ), 'education-purple' => __( 'Purple' , 'education' ), 'education-red' => __( 'Red' , 'education' ), 'education-navy' => __( 'Navy' , 'education' ), 'education-teal' => __( 'Teal' , 'education' ) ) ); add_action( 'genesis_meta', 'education_add_viewport_meta_tag' ); /** Add Viewport meta tag for mobile browsers */ function education_add_viewport_meta_tag() { echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>'; } function display_category_archives_description () { if (is_category() ) { echo category_description( $category-id ); }} add_action( 'genesis_before_loop', 'display_category_archives_description'); /** * @author Brad Dalton - WP Sites * * @link http://wpsites.net/web-design/display-image-on-all-category-pages/ */ /** Add new image sizes */ add_image_size( 'featured-image', 150, 100, TRUE ); /** Add structural wraps */ add_theme_support( 'genesis-structural-wraps', array( 'header', 'nav', 'subnav', 'inner', 'footer-widgets', 'footer' ) ); /** Add support for custom background */ add_theme_support( 'custom-background', array( 'default-image' => get_stylesheet_directory_uri() . '/images/bg.png', 'default-color' => 'f5f5f5', ) ); /** Add support for custom header */ add_theme_support( 'custom-header', array( 'width' => 380, 'height' => 100, 'header-selector' => '#title a', 'header-text' => false ) ); /** Add support for 3-column footer widgets */ add_theme_support( 'genesis-footer-widgets', 3 ); /** Reposition Primary Navigation */ remove_action( 'genesis_after_header', 'genesis_do_nav' ); add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' ); /** Reposition Secondary Navigation */ remove_action( 'genesis_after_header', 'genesis_do_subnav' ); add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_subnav' ); /** Reposition Breadcrumbs */ remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' ); add_action( 'genesis_before_content', 'genesis_do_breadcrumbs' ); add_filter( 'genesis_comment_list_args', 'child_comment_list_args' ); /** Change avatar size */ function child_comment_list_args( $args ) { $args = array( 'type' => 'comment', 'avatar_size' => 33, 'callback' => 'genesis_comment_callback' ); return $args; } /** Register widget areas */ genesis_register_sidebar( array( 'id' => 'slider', 'name' => __( 'Slider', 'education' ), 'description' => __( 'This is the slider section.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'intro', 'name' => __( 'Intro', 'education' ), 'description' => __( 'This is the intro section displayed below the slider.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'featured', 'name' => __( 'Featured', 'education' ), 'description' => __( 'This is the featured section displayed below the intro.', 'education' ), ) ); genesis_register_sidebar( array( 'id' => 'call-to-action', 'name' => __( 'Call To Action', 'education' ), 'description' => __( 'This is the call to action banner.', 'education' ), ) );
Also, I wanted to note that I removed the "education pro" tag from this post because this is NOT Education Pro. I am using Pro on a subdirectory site (and have been for years) but this site in the root of the domain is the "Education Child Theme."
July 17, 2017 at 4:31 pm #209234BonnieMemberAny admin who wants to delete my doofus duplicate post, I'd be grateful. 😉
So I've been trying different things, but am still unable to bring the blog posts back to the front page. I'm hoping someone might have a solution for me, other than switching to Education Pro as our board prefers the look of the original Education theme.
Edited to add:
I found the original Education theme files (yay, Archive section in "My StudioPress"!) and I see that I did move things around on the front page, basically move the Call to Action up and the Featured section down. Everything else looks the same.
July 31, 2017 at 1:58 pm #209773BonnieMemberFinally fixed... it was this user's error. 🙁
I had added a customization to my home page sidebar settings in Custom CSS that prevented the posts from showing.
July 31, 2017 at 2:02 pm #209774Brad DaltonParticipantDecember 8, 2017 at 1:08 am #214380dsvakolaMemberMy problem is slightly different.
I have created one "What's New" post category and I want to show the posts from this category only in slider.
So I setup the slider to show the posts from this slider only.But now what I want is that the posts from this category should not be displayed below on home page. And all other posts should be displayed.
This is because, the posts from "What's new" category are already being displayed above, so its meaningless to show them again in blog loop below, on home page.
So can you help me in this?
Please its very important customization for me.
You can check my site on this link:
http://www.prabhatkids.edu.in/Thanks in advance.
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.