• 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

Added div before content and sidebar is pushed down

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 › General Discussion › Added div before content and sidebar is pushed down

This topic is: not resolved

Tagged: genesis_before_content, parallax-pro, sidebar pushed down

  • This topic has 5 replies, 3 voices, and was last updated 10 years, 3 months ago by braderz31.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • February 27, 2015 at 11:45 am #142551
    braderz31
    Member

    Hi,

    I'm customizing the Parallax Pro theme and I need to add a div above the content on one of the layouts.

    I've managed to do this using the hook 'genesis_before_content' - the only problem is, the sidebar is now pushed down with the content. I can't added a negative top margin to the sidebar because the content in the new div is dynamic and so could change the div height.

    Any thoughts on what I can do please.

    Many thanks

    Brad

    http://justadevsite.com/nls/treatments
    February 27, 2015 at 1:45 pm #142564
    Victor Font
    Moderator

    Try this in your functions.php:

    remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
    add_action( 'genesis_before_content', 'genesis_get_sidebar' );

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    February 27, 2015 at 2:32 pm #142576
    braderz31
    Member

    Victor - you are a star!!!!

    Thank you, the code works.

    Can I just check that my code is correct... it works I just want to make sure I'm doing it right

    //Add Call To Action Box
    function cta_box() {
    	$cta = get_field('call_to_action');
    	echo '<div class="cta-box">'.$cta.'</div>';
    }
    add_action('genesis_before_content', 'cta_box');
    remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
    add_action( 'genesis_before_content', 'genesis_get_sidebar' );	
    February 27, 2015 at 2:57 pm #142581
    Victor Font
    Moderator

    Your code looks fine to me. Good job!


    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    February 28, 2015 at 4:13 am #142637
    Brad Dalton
    Participant

    You could also use

    genesis_get_custom_field

    Tutorials for StudioPress Themes.

    March 4, 2015 at 1:35 am #143149
    braderz31
    Member

    Guys - thanks all for the help here.

    For anyone else trying to achieve this, you will notice your sidebar will now appear above the page content when viewed on a mobile device. I personally didn't want this so I tweaked the code to ensure the hooks are only actioned if the page is not viewed on a mobile device

    if ( ! wp_is_mobile() ) {
    	remove_action( 'genesis_after_content', 'genesis_get_sidebar' );
    	add_action( 'genesis_before_content', 'genesis_get_sidebar' );	
    }

    Hope this helps 🙂

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The forum ‘General Discussion’ 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