• 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_action('genesis_before_content_sidebar_wrap ', 'function'); outputting code.

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 › add_action('genesis_before_content_sidebar_wrap ', 'function'); outputting code.

This topic is: not resolved

Tagged: function, hooks, html, must use plugin, wrap

  • This topic has 9 replies, 2 voices, and was last updated 7 years, 3 months ago by Christoph.
Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • August 12, 2016 at 1:13 pm #191177
    aschoenbrun
    Member

    Hi,

    I am using a modified version of the Sample Genesis starter child theme by Sridhar Katakam (https://github.com/srikat/genesis-sample). I am trying to add multiple custom divs to wrap around the site content. This is so I can use the technique found here (http://matthewjamestaylor.com/blog/equal-height-columns-cross-browser-css-no-hacks).

    I've placed the following code in a "Must Use" plugin:

    function framework_content_adjust() {
    
      // 1 - Equal Height Element wrapper tops
      add_action('genesis_before_content_sidebar_wrap
    ', 'equal_height_content_start');
      function equal_height_content_start() { ?>
    
        <div id="ContentWrapper">
    
          <div id="SidebarBorder">
    
            <div id="ContentReplace">
    
      <?php }
    
      // 2 - Equal Height Element wrapper bottoms
      add_action('genesis_after_content_sidebar_wrap', 'equal_height_content_end');
      function equal_height_content_end() { ?>
    
            </div>
    
          </div>
    
        </div>
    
      <?php }
    
    }
    add_action('after_setup_theme', 'framework_content_adjust', 2, 50);

    I know the code is executing to some degree, since while testing I moved all code to the first plugin and a conflict was noted.

    What am I doing wrong that is stopping this code from outputting the HTML markup?

    Thank you so much.

    http://torahthinking-genesis.youreffectivemedia.com/
    August 12, 2016 at 1:42 pm #191182
    Christoph
    Member

    Hi,

    not sure why you'd want to use that method (or if that is the right hook), but just echo your markup.

    echo '<div id="ContentWrapper"><div id="SidebarBorder"><div id="ContentReplace">';

    No need to switch in and out of php.
    http://prntscr.com/c4z2u2


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    August 12, 2016 at 1:49 pm #191183
    aschoenbrun
    Member

    Thanks for answering, Christoph,

    I switch in and out since it's easier for me to code HTML without getting distracted by php. I made the changes anyway to see if that would work:

    function framework_content_adjust() {
    
      // 1 - Equal Height Element wrapper tops
      add_action('genesis_before_content_sidebar_wrap
    ', 'equal_height_content_start');
      function equal_height_content_start() {
    
        echo '<div id="ContentWrapper"><div id="SidebarBorder"><div id="ContentReplace">';
    
      }
    
      // 2 - Equal Height Element wrapper bottoms
      add_action('genesis_after_content_sidebar_wrap', 'equal_height_content_end');
      function equal_height_content_end() {
    
        echo '</div></div></div>';
    
      }
    
    }
    add_action('after_setup_theme', 'framework_content_adjust', 2, 50);

    Still, the changes are not being reflected.

    August 12, 2016 at 2:11 pm #191184
    Christoph
    Member

    Try using

    'genesis_after_header'

    instead of

    'after_setup_theme'


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    August 12, 2016 at 2:32 pm #191186
    aschoenbrun
    Member

    Nothing.

    I must say I've been having a lot of trouble hooking and unhooking functions, some of which are essentially simple html. The only success I've had was the first MU plugin I did to replace the site title with the logo.

      function framework_header_adjust() {
    
    // 1, 2, 3 - Replace name and description with logo
      remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
      remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
      add_action('genesis_site_title', 'ttg_logo');
      function ttg_logo() { ?>
    
        <div id="Logo">
    
          <?php
            $attachment_id = get_field('Logo', 'options');
            $size = "Logo";
            $image = wp_get_attachment_image_src( $attachment_id, $size );
            // url = $image[0];
            // width = $image[1];
            // height = $image[2];
          ?>
    
          <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    
            <img src="<?php echo $image[0]; ?>" alt="<?php bloginfo('name'); ?>" />
    
          </a>
    
        </div>
    
      <?php }
    
    }
    add_action('after_setup_theme','framework_header_adjust', 1, 50);

    Any subsequent hooking or unhooking has not worked, whether added as an MU plugin or applied straight to the child theme's functions.php. Please note I have been referencing the hooks and actions by searching through the Genesis parent theme folder ans well as by using the Genesis Visual Hook Guide plugin (https://wordpress.org/plugins/genesis-visual-hook-guide/)

    August 12, 2016 at 2:35 pm #191189
    aschoenbrun
    Member

    I want to add custom content to this site. I must be going about it wrong, I just dont know how

    August 12, 2016 at 2:41 pm #191190
    aschoenbrun
    Member

    Did a test in that MU plugin for the divs:

    add_action('genesis_before_content_sidebar_wrap', 'ttg_test');
      function ttg_test() {
        echo '<p>Hello</p>';
      }

    It worked. So now I'm even more confused

    August 12, 2016 at 2:44 pm #191191
    aschoenbrun
    Member
      // 1 - Equal Height Element wrapper tops
      add_action('genesis_before_content_sidebar_wrap
    ', 'equal_height_content_start');
      function equal_height_content_start() {
        echo '<p>Hello</p>';
      }
    
      // 2 - Equal Height Element wrapper bottoms
      add_action('genesis_after_content_sidebar_wrap', 'equal_height_content_end');
      function equal_height_content_end() {
        echo '<p>Hello</p>';
      }

    Did not work. Must be something wrong with those specifically

    August 12, 2016 at 2:57 pm #191192
    aschoenbrun
    Member

    Works now. I have no idea what did it. I copied and pasted one action to the other, then modified to match original. I added `echo '<p>Hello</p>' to each, then removed. After all said & done, it works. The only thing I can think of is that when I copied the hook text, somehow hidden characters came along. I have no idea why they would though. I use Atom, which, at its core, is a text editor (I believe.). Any insight woudl be appreciated...
    Thanks so much Christoph`

    August 12, 2016 at 3:13 pm #191194
    Christoph
    Member

    Wonderful!
    I´m happy it started to work. 🙂

    I can't really tell you what was going on.
    Maybe a line-break, maybe something else.
    Your code (when not on the after_setup_theme hook) worked for me in functions.php and a mu plugin.

    I was/am using Atom (with about 20+ packages /extensions), too.


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

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

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