• 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

Add widget to div within page content on Genesis landing page template

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 › Add widget to div within page content on Genesis landing page template

This topic is: not resolved

Tagged: Add Widget to landing page

  • This topic has 7 replies, 2 voices, and was last updated 11 years, 9 months ago by RichardPD.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • October 30, 2014 at 6:34 pm #129952
    RichardPD
    Member

    My genesis child theme has 4 footer widget areas registered on my landing page and I am using one to add eNews email sign up widget in the footer of my site landing page (ie after my page content at the bottom of the page).

    I want now to add a widget to a div within the landing page (#pagewidget) and have registered a widget area but I do not know what action code I need to make it work! I have tried several code attempts without success.

    This is my current functions.php code for this:

    //*RPD register landingpage widget in pagewidget div area
    genesis_register_sidebar(array(
     'name'=>'LandingPageWidget ',
     'id' => 'pagewidget',
     'description' => 'This is the widget area of the landingpage pagewidget div area.',
    
    ));
    
    //* Add widget area in landing page content in pagewidget div
    
    function add_LandingPageWidget() {
    	LandingPageWidget( 'pagewidget', array(
    'before' => '<div id="pagewidget">',
    'after' => '</div>',
     ) );
    }
    

    This is my site:Chess Rating Rise

    I am most grateful if anyone can help me and provide the right action code to add this widget area properly to the landing page div area. I look forward to helpful replies, many thanks

    http://chessratingrise.co.uk/
    October 30, 2014 at 11:31 pm #129962
    WisdmLabs
    Member

    Hi Richard,

    In your landing page add this code inside your div where you need the widget content.

    <?php genesis_widget_area( 'pagewidget', array( 'before' => '<div class="pagewidget widget-area">', 'after' => '</div>')); ?>


    http://wisdmlabs.com/

    October 31, 2014 at 3:23 am #129975
    RichardPD
    Member

    Hi
    Thanks for your help but this hasn't worked properly..

    I added the code to the landing page directly where it did not display and into the landing page template.php
    when I had a PHP error saying unexpected < .

    The image below shows the result with it added to the div directly in the landing page...
    Add widget to div in landing page error

    I'm grateful for any further help to get this working..thanks

    October 31, 2014 at 5:40 am #129983
    WisdmLabs
    Member

    Hi Richard,

    The code needs to be in the template.
    In case you are inserting this code in between html tags, only then you need to add the opening and closing php tags ie <?php and ?>
    else if the code is within a php block, simply copy
    genesis_widget_area( 'pagewidget', array( 'before' => '<div class="pagewidget widget-area">', 'after' => '</div>'));


    http://wisdmlabs.com/

    October 31, 2014 at 6:09 am #129989
    RichardPD
    Member

    Hi
    Thanks for your further help.
    This code has put the #pagewidget at the top of the landing page and that is where the eNews plugin is placed.
    I put #pagewidget div into the middle of the page content where I want the widget area to be!

    This is the code I have in my landing page template
    genesis_widget_area( 'pagewidget', array( 'before' => '<div id="pagewidget">', 'after' => '</div>'));

    This is the code I have in my theme functions

    //*RPD register landingpage widget in pagewidget div area
    genesis_register_sidebar(array(
     'name'=>'LandingPageWidget ',
     'id' => 'pagewidget',
     'description' => 'This is the widget area of the landingpage pagewidget div area.',
    
    ));
    
    //* Add widget area in landing page content in pagewidget div
    
    function add_LandingPageWidget() {
    	LandingPageWidget( 'pagewidget', array(
    'before' => '<div id="pagewidget">',
    'after' => '</div>',
     ) );
    }

    See this on siteChess Rating Rise

    HELP!

    I've been following several tutorials to try and understand this myself but I have not seen one tutorial creating a new widget area in a page (most are for posts) and most are using hooks that place the widget in places I don't want it!

    I'm grateful for more help and advice to fix this, many thanks

    October 31, 2014 at 6:48 am #129995
    WisdmLabs
    Member

    Hi Richard,

    You would not need the code

    function add_LandingPageWidget() {
    	LandingPageWidget( 'pagewidget', array(
    'before' => '<div id="pagewidget">',
    'after' => '</div>',
     ) );
    }

    The code snippet in functions.php should be

    genesis_register_sidebar( array(
    	'id'            => 'pagewidget',
    	'name'          => __( 'LandingPageWidget', 'themename' ),
    	'description'   => __( 'This is a widget area ', 'themename' ),
    ) );
    

    Suppose i wish to display the content of this widget area in my front-page.php template inside a particular div,
    my code would be

    <div class="myDiv">
    <?php genesis_widget_area( pagewidget', array( 'before' => '<div class="pagewidget widget-area">', 'after' => '</div>')); ?>
    </div>

    http://wisdmlabs.com/

    October 31, 2014 at 7:07 am #129998
    RichardPD
    Member

    Hi
    Thanks for your further help. I'm sure this is very simple for you but I have spent hours now trying to fix it.
    Using your example landing page code I get this error:
    A white browser screen with the php error message:
    Parse error: syntax error, unexpected '<' in /home4/hilaryd/public_html/chessratingrise.co.uk/wp-content/themes/Standard_Gen/page_landing.php on line 71

    This was the code that I used
    '<div class="MyPageWidget">
    <?php genesis_widget_area( pagewidget', array( 'before' => '<div class="pagewidget widget-area">', 'after' => '</div>')); ?>
    </div>`
    I have just removed this and I will keep trying to figure this out and get it to work but I would still really like your help if possible.
    Many thanks for helping me so far with this, best wishes 🙂

    November 2, 2014 at 4:54 am #130161
    RichardPD
    Member

    In brief I have given up trying to do this for the moment.
    I have spent ages trying to get a widgetised area in the content on my landing page and while I'm sure I could eventually succeed with this I've spent too long trying (at least I know some ways that do not work!..all experience!).
    As I've said most information on site posts show how to register and activate a widget area in specific parts of a Genesis/Genesis Child theme using hooks (in the footer, above the header,after the header, before and after post content).
    Of the many posts explaining this I think I've only seen one post trying to add a widget to a custom template and that didn't work for me.

    Instead I have done an alternative which is directly use HTML form code within my page content at the place I want to put it.
    The form style code isn't elegant as it is borrowed from elsewhere, again as I did not have my own form code premade. I have integrated it with my Aweber code and it is satisfactory for the moment (I'll probably find it doesn't work as a responsive form sometime soon!).

    Anyway I have learnt a little more about Genesis (as this is my first ever Genesis/Genesis child theme and site).
    However I now need to spend time working on my site products and posts and not be spending time coding the theme!
    Possibly, when I have set the site up fully I will revisit all this and try it again but for now I must press on with the rest of the site and other issues.

    This post has been sinking fast down the page list in this forum over the last 2 days and soon will be buried deep in the bowels of historic pages.
    Bye and goodluck to all using widgetised areas in landing pages and to all Genesis users and developers! 🙂

  • Author
    Posts
Viewing 8 posts - 1 through 8 (of 8 total)
  • 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

© 2026 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