Community Forums › Forums › Archived Forums › Design Tips and Tricks › Widget Ready Home Page Modern Blogger Pro
Tagged: modern blogger pro
- This topic has 11 replies, 3 voices, and was last updated 10 years, 6 months ago by krystyn.
-
AuthorPosts
-
June 27, 2014 at 5:31 pm #111818krystynParticipant
I'd like to make the home page of modern blogger pro widget ready so I can use featured post and do several different arrangements of posts (ie large featured, then two rows side by side, then another large featured).
I've used this tutorial and added everything.
There was some stuff on home.php originally but I had to delete it for the page to display. However, I've added a widget to "home top" (the widgets seem to have registered perfectly), but the home page isn't displaying the featured posts I've put in home top.
The original home.php:
add_action( 'genesis_meta', 'modernbloggerpro_home_genesis_meta' );
/**
* Add widget support for homepage.
*
*/
function modernbloggerpro_home_genesis_meta() {if ( is_active_sidebar( 'slider' )) {
add_action( 'genesis_before_loop', 'modernbloggerpro_home_loop_helper' );
}
}/** Remove the ad widget **/
remove_action( 'genesis_before_loop', 'adspace_before_loop' );/**
* Display widget content for home slider section
*
*/
function modernbloggerpro_home_loop_helper() {if ( is_active_sidebar( 'slider' )) {
echo '<div id="slider">';
echo '<div class="slider">';
dynamic_sidebar( 'slider' );
echo '</div><!-- end .slider -->';
echo '</div><!-- end #slider -->';}
}
My new home.php:
<?php
add_action( 'genesis_meta', 'modern_home_genesis_meta' );
/**
* Add widget support for homepage. If no widgets active, display the default loop.
*
*/
function modernbloggerpro_home_genesis_meta() {if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) {
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'news_home_loop_helper' );
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_content_sidebar' );
add_filter( 'body_class', 'add_body_class' );
function add_body_class( $classes ) {
$classes[] = 'modernbloggerpro';
return $classes;
}}
}function news_home_loop_helper() {
if ( is_active_sidebar( 'home-top' ) ) {
echo '<div id="home-top"><div class="border wrap">';
dynamic_sidebar( 'home-top' );
echo '</div><!-- end .border wrap --></div><!-- end #home-top -->';}
if ( is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) ) {
echo '<div id="home-middle"><div class="border wrap">';
echo '<div class="home-middle-left">';
dynamic_sidebar( 'home-middle-left' );
echo '</div><!-- end .home-middle-left -->';echo '<div class="home-middle-right">';
dynamic_sidebar( 'home-middle-right' );
echo '</div><!-- end .home-middle-right -->';echo '</div><!-- end .border wrap --></div><!-- end #home-middle -->';
}
if ( is_active_sidebar( 'home-bottom' ) ) {
echo '<div id="home-bottom"><div class="border wrap">';
dynamic_sidebar( 'home-bottom' );
echo '</div><!-- end .border wrap --></div><!-- end #home-bottom -->';}
}
genesis();
Is it because there are other widgets in there? Like slider and portfolio? What did I miss?
http://www.krizzydesigns-test.com/test3June 28, 2014 at 12:02 am #111844Brad DaltonParticipantThis code cannot be tested because it breaks when you embed PHP directly into a webpage.
Please paste PHP code into a Github Gist and then link to it or embed it here. Thanks
June 28, 2014 at 7:53 am #111862krystynParticipantSorry about that @braddalton. Hopefully this works.
Here's my original home edits (ie, what I'm using now):
<script src="https://gist.github.com/anonymous/0096407243bad8f64110.js"></script>Here's the modern home code that comes with the theme:
<script src="https://gist.github.com/anonymous/4afd5f28b9fe6575c86f.js"></script>
When I tried to combine the two nothing loaded on the home page at all. No header, no background, anything. Just a white space.
June 28, 2014 at 10:34 pm #111929Brad DaltonParticipantJune 29, 2014 at 8:07 am #111968krystynParticipant@braddalton let me try one more time. Sorry about that.
<script src="https://gist.github.com/anonymous/e131e74e816288614be4.js"></script>
June 29, 2014 at 9:15 am #111973Brad DaltonParticipantBut where's the functions code which registers all the widgets?
Also, have you posted this on the theme Devs support forum?
June 29, 2014 at 9:22 am #111974krystynParticipantTo register the widgets, I used the tutorial here and swapped out the names: http://www.studiopress.community/topic/add-additional-featured-widget-on-homepage-of-blissful/
I haven't posted on the support page as it says that customizations aren't part of the help.
Here's the entirety of my functions.php:
<script src="https://gist.github.com/anonymous/6e1128b0fb16387f428e.js"></script>
I feel like I've just got one thing wrong and I can't figure it out. I know (think?) they are registered fine because they show on the widgets page. And, I can add things (and have added things to them), but the home page isn't changing and instead is just showing the most recent posts in order.
June 30, 2014 at 8:48 pm #112303krystynParticipant@braddalton, I forgot to tag you.
June 30, 2014 at 10:02 pm #112307TonyaMemberHi,
Notice that the function for your new widgets is called: news_home_loop_helper(); However, in the function modernbloggerpro_home_genesis_meta(), it is referencing the wrong function name: add_action( 'genesis_loop', 'modernbloggerpro_home_loop_helper' );
add_action( 'genesis_meta', 'modern_home_genesis_meta' ); /** * Add widget support for homepage. If no widgets active, display the default loop. * */ function modernbloggerpro_home_genesis_meta() { if ( is_active_sidebar( 'home-top' ) || is_active_sidebar( 'home-middle-left' ) || is_active_sidebar( 'home-middle-right' ) || is_active_sidebar( 'home-bottom' ) ) { remove_action( 'genesis_loop', 'genesis_do_loop' ); add_action( 'genesis_loop', 'news_home_loop_helper' ); // Changed from modernbloggerpro_home_loop_helper
Software & Electrical Engineer and Programming Teacher ยท I’m on a mission to help developers be more awesome.
Find Me: KnowTheCode.io | @hellofromTonya | Profitable WordPress Developer BootcampJuly 1, 2014 at 2:11 pm #112504krystynParticipantThanks @tonya_lunarwp for the catch. I've changed it with no luck. I've added genesis grid to add some options, but it's not idea. I can't figure out what's wrong.
July 1, 2014 at 10:09 pm #112556Brad DaltonParticipantJuly 2, 2014 at 9:04 am #112638krystynParticipantOkay, @braddalton, I guess I will have to start over.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.