• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

HTML5 Code to add extra widget – Can Someone Please Check it?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › HTML5 Code to add extra widget – Can Someone Please Check it?

This topic is: resolved

Tagged: Add widget to home page, html5, Outreach Pro

  • This topic has 28 replies, 2 voices, and was last updated 11 years, 6 months ago by nutsandbolts.
Viewing 20 posts - 1 through 20 (of 29 total)
1 2 →
  • Author
    Posts
  • January 5, 2014 at 9:37 pm #83480
    palpatine
    Member

    Hello All,

    I'm trying to add a widget to the Outreach Pro theme, for the Home page ONLY, right under the bottom 4 widgets (called home-bottom).

    From all the tutorials, I've compiled this code below. Will this work?:

    Code to create new Home page widget in functions.php:

    genesis_register_sidebar( array(
    'id' => 'home-content',
    'name' => __( 'Home - Content', 'outreach' ),
    'description' => __( 'This is the main content section of the Home page.', 'outreach' ),
    ) );

    Code to add to front-page.php:

    //* Add home content widget
    add_action( 'genesis_before_footer', 'outreach_home_content_widget' );

    Code to add to Outreach Pro style.css:

    .home-content .widget {
    margin: 0;
    padding: 0 40px 40px;
    padding: 0 4rem 4rem;
    }

    .home-content .widget {
    padding-top: 40px;
    padding-top: 4rem;
    }

    I just want an area to post some unique text content on the Home page, so if there's something that I'm leaving out, I'd really appreciate someone correcting me.

    Also, I've never done anything in HTML5, so I'd really like someone's expert opinion before I just paste this code on my site.

    One more thing...

    The home-bottom (default home page widgets) already use the 'genesis_before_footer' hook, so how will the theme know to execute this code below the other code that is already there with the same hook?

    I hope I'm being clear here, but if anyone has any recommendations or questions, I'd really appreciate it.

    Thanks,
    Aaron

    January 5, 2014 at 9:43 pm #83482
    nutsandbolts
    Member

    Looks good, except you need a little more in front-page.php. Something like this:

    //* Add home content widget
    add_action( 'genesis_before_footer', 'outreach_home_content_widget', 11 );
    function outreach_home_content_widget() {
    	genesis_widget_area( 'home-content', array(
    		'before' => '<div class="home-content widget-area">',
    		'after'  => '</div>',
    	) );
    }

    That 11 that I added to your add_action line *should* prioritize the new widget area below home-bottom, but if it doesn't, try increasing or decreasing the number (depending on where it shows up). If you run into trouble, update here and I'll do my best to help.


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 10:41 pm #83488
    palpatine
    Member

    Hi Andrea,

    Thank you so much for your assistance.

    Unfortunately, it's not working 🙁

    I did try different numbers, other than 11, but nothing shows up where the widget is supposed to be. It's like I didn't add an extra widget at all. There is a space between the , and the 11, and a space afterwards. Not sure if that matters or not, but I used the exact code that is mentioned above. I just cut and pasted.

    Any other ideas?

    Thanks,
    Aaron

    January 5, 2014 at 10:45 pm #83489
    nutsandbolts
    Member

    Hold on... Let me throw Outreach Pro on a test site and I'll see why it's not happy. 🙂


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 10:49 pm #83491
    palpatine
    Member

    You're Awesome! I can send you a link to the site I'm working on if that makes things easier. Can we PM in this forum? Or, do you want to send me your email?

    Either way, I'm eagerly waiting to hear what you come up with.

    Thanks Again,
    Aaron

    January 5, 2014 at 10:51 pm #83492
    palpatine
    Member

    I'll bet it has to go under that if statement in front-page.php. Just a guess, I really have no idea.

    January 5, 2014 at 10:52 pm #83493
    nutsandbolts
    Member

    Okay, assuming you haven't customized anything else in front-page.php, this will work (this is a whole new front-page.php for you to upload in place of your current one) - https://www.dropbox.com/s/wirn9rlt6kouoat/front-page.php


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 10:57 pm #83494
    palpatine
    Member

    Well, without just replacing my front-page.php with this, it looks like you did this, under the if statement:

    //* Add home content widgets
    add_action( 'genesis_before_footer', 'outreach_home_content_widgets' );

    I noticed that widgets is now plural, instead of singular as we had it before. Is that going to make a difference?

    Also, was there a way to prioritize this widget to show up after the home-bottom widgets?

    Thanks,
    Aaron

    January 5, 2014 at 11:00 pm #83496
    nutsandbolts
    Member

    I did that, but I also added to the if statement and added the function for the widget area at the bottom. Which is why it's just easier to replace the whole thing - that way nothing gets left out.

    The home bottom area already has a priority of 1, so there's no need to prioritize the home content area - it will automatically display after home bottom. I've got it working on a test site here (albeit with no CSS): http://newjohn.nutsandboltsmedia.com/


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:01 pm #83497
    nutsandbolts
    Member

    And of course I said that and just did something that caused it to stop displaying... Hold on.


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:04 pm #83498
    palpatine
    Member

    Okay, no worries. Standing by...

    January 5, 2014 at 11:04 pm #83499
    nutsandbolts
    Member

    Ah, my bad. It does need priority because of the subfooter left and right areas - forgot about those. (It's showing in black between the home bottom and subfooter areas right now - no CSS as I said.)

    		//* Add home content widgets
    		add_action( 'genesis_before_footer', 'outreach_home_content_widgets', 2 );

    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:07 pm #83501
    nutsandbolts
    Member

    New link to front-page.php: https://www.dropbox.com/s/f0c0sl5eq3c38me/front-page.php

    Widget vs. widget doesn't matter as long as the usage is consistent in both places. If one differs from the other, you'll break your site.


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:09 pm #83502
    palpatine
    Member

    When I just added that small piece of code above, I get the black box as well, but there's hidden text in it that says:

    Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, 'outreach_home_content_widgets' was given in /home2/ocr/public_html/wp-includes/plugin.php on line 42

    January 5, 2014 at 11:10 pm #83503
    nutsandbolts
    Member

    That's why I gave you the whole thing and said it would be easier to replace the entire file. 😀


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:12 pm #83504
    palpatine
    Member

    Whoops, nevermind, I added that other code at the bottom of the page and it works good. Thanks.

    Now, I just need to figure out how to make the background white (like home-bottom) and the text black.

    Got a quick fix for me?

    January 5, 2014 at 11:13 pm #83505
    nutsandbolts
    Member

    CSS:

    #home-content {
    background-color: #fff;
    color: #000;
    }

    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:15 pm #83507
    palpatine
    Member

    Thanks sooooo much. I'll add that to the stylesheet.

    I really appreciate your assistance Andrea. Have a good one.

    -Aaron

    January 5, 2014 at 11:15 pm #83508
    nutsandbolts
    Member

    No problem! Sorry for the confusion - that's what happens when I work too late at night.

    I'm going to mark this topic as resolved but feel free to open a new one if you need more help. 🙂


    Andrea Whitmer, Owner/Developer, Nuts and Bolts Media
    I provide development and training services for designers • Find me on Twitter and Google+

    January 5, 2014 at 11:17 pm #83509
    palpatine
    Member

    You got it.

    But, before I let you go... I noticed that this looks different than what's in the current stylesheet. Does this CSS go in the front-page, or the stylesheet?

    Thanks,
    Aaron

  • Author
    Posts
Viewing 20 posts - 1 through 20 (of 29 total)
1 2 →
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble