Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to design custom home page
Tagged: Custom Home Page, design, featured post
- This topic has 6 replies, 2 voices, and was last updated 6 years, 1 month ago by theUser.
-
AuthorPosts
-
June 21, 2013 at 7:22 am #47019theUserMember
Hello there.
I want to re-design my own blog with a custom home page but I do not know how to start coding. My home page design is about add 5 featured post (widget) before post listing. For reference check out http://goo.gl/2RFse.Please advice me.
Pernando Ritonga
http://www.techlint.com/June 21, 2013 at 10:14 am #47050Brad DaltonParticipantYou could add 2 widgets using the genesis_before_loop hook and add content columns for 2 and columns to the widgets.
Another way would be use a custom grid loop or you could create multiple widgets side by side.
One of the benefits of owning the Pro plus package is the fact you get access to all the code. You could take the code from the home.php file from any child theme and use that in your custom theme. Far easier than writing the code and learning PHP coding.
Here's the code for adding one widget area to the home page.
Please copy this code from the view raw link and paste this code at the end of your child themes functions.php using a code editor.
You can duplicate this code and change the third parameter from ,5 to ,15. Also change the i.d for the widget.
Non coders should install WordPress locally and test the code before editing a live site.
June 21, 2013 at 11:16 am #47063theUserMemberThis reply has been marked as private.June 21, 2013 at 3:04 pm #47102Brad DaltonParticipantSorry but i don't receive private replies for some reason. You can contact me using my email [email protected]
June 22, 2013 at 8:42 pm #47254theUserMemberHello Mr. Dalton. Thank you for your kindness.
I’m sorry. After my above post, I tried googling and found a few things on Mr Brian site and code snippet/tutorial on my StudioPress account. And I tried a few things.
Child theme : Goblogoon Theme
1. I’ve added a widget before content. Here’s my code:
<?php add_action( 'genesis_meta', 'goblogoon_home_genesis_meta' ); /** * Add widget support for homepage. * */ function goblogoon_home_genesis_meta() { if ( is_active_sidebar( 'home-featured-post' ) ) { add_action( 'genesis_before_content', 'goblogoon_home_loop_helper' ); } } /** * Display widget content for home featured sections. * */ function goblogoon_home_loop_helper() { if ( is_active_sidebar( 'home-featured-post' ) ) { echo '<div id="home-featured-post"><div class="wrap clearfix">'; dynamic_sidebar( 'home-featured-post' ); echo '</div><!-- end .wrap --></div><!-- end #home-featured-post -->'; } } genesis();
And then, create home.php. Here my code that take it from my balance child theme:
<?php add_action( 'genesis_meta', 'goblogoon_home_genesis_meta' ); /** * Add widget support for homepage. * */ function goblogoon_home_genesis_meta() { if ( is_active_sidebar( 'home-featured-post' ) ) { add_action( 'genesis_before_content', 'goblogoon_home_loop_helper' ); } } /** * Display widget content for home featured sections. * */ function goblogoon_home_loop_helper() { if ( is_active_sidebar( 'home-featured-post' ) ) { echo '<div id="home-featured-post"><div class="wrap clearfix">'; dynamic_sidebar( 'home-featured-post' ); echo '</div><!-- end .wrap --></div><!-- end #home-featured-post -->'; } } genesis();
Is it better to use ‘genesis_before_loop’ instead of ‘genesis_before_content’? Advice me, please?
I see there are some similarities with yours. But the fact is, when I try it (my code) on the local host, it became fullwidth and genesis featured post reduce the number of front-page post. It mean, If I set 10 posts to show at the front page, 5 post for genesis featured widget, then appear 5 post only under widget.
Q: What’s the different of ‘genesis_before_loop’ and ‘genesis_before_content’? Do I have complete the home.php code?
Advice me, please?
I became increasingly curious.
June 22, 2013 at 9:49 pm #47262Brad DaltonParticipantThe code i embedded doesn't display any posts on the home page. You can easily create a new page and select the blog page template to display a list of posts.
June 23, 2013 at 12:13 am #47265theUserMemberCorrection for my no 1 code (functions.php):
//* Register a new sidebar genesis_register_sidebar( array( 'id' => 'home-featured-post', 'name' => __( 'Home Featured Post', 'goblogoon' ), 'description' => __( 'Featured Post widget before post list!', 'goblogoon' ), ) );
The code i embedded doesn’t display any posts on the home page. You can easily create a new page and select the blog page template to display a list of posts.
It mean we need to set Reading Setting on Setting Panel WordPress Admin to static page, blog as post page? How about home page section?
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.