Genesis Compatibility Code

This topic contains 3 replies, has 4 voices, and was last updated by  t c 9 years, 9 months ago.

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket
  • Author
    Posts
  • #7071

    John Allsopp
    Expired Member
    Post count: 399

    This is a work in progress, but it may come in handy for you Genesis users.

    I like to have things structured nicely, so i added this as an include rather than throwing it into functions.php – here is what i did…

    Added a folder to my child theme called “inc”

    Inside that folder, created a file called wpgeo-compat.php, with the following code:

    
    
    <?php
    /*
    * Add compatibility for Genesis
    
    * @author John Allsopp
    * @link http://poshweb.co.uk/
    
    * Note that by putting content inside the Genesis content/sidebar areas, the width controls inside the WPGeo dashboard will have no effect whatsoever
    * Your Genesis default layout should be set to content/sidebar or sidebar/content (not fullwidth)
    */
    
    //* Removes opening and closing #geodir-wrapper
    //  Alternatively we can comment-out the following 2 lines and .content-sidebar-wrap would be added outside #geodir-wrapper
    remove_action( 'geodir_wrapper_open', 'geodir_action_wrapper_open', 10 );
    remove_action( 'geodir_wrapper_close', 'geodir_action_wrapper_close', 10);
    
    //* Open .content-sidebar-wrap
    add_action( 'geodir_wrapper_open', 'pw_content_sidebar_wrap_open', 9 );
    function pw_content_sidebar_wrap_open() {
    	echo '<div class="content-sidebar-wrap">';
    }
    
    //* Close .content-sidebar-wrap
    add_action( 'geodir_wrapper_close', 'pw_content_sidebar_wrap_close', 11);
    function pw_content_sidebar_wrap_close() {
    	echo '</div>';
    }
    
    //* Removes opening and closing .geodir-wrapper-content
    remove_action( 'geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10 );
    remove_action( 'geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10);
    
    //* Open the Genesis .content instead of .geodir-wrapper-content
    add_action( 'geodir_wrapper_content_open', 'pw_content_open', 9, 3 );
    function pw_content_open($type='',$id='',$class='') {
    	echo '<main class="content '. $class .'" itemprop="mainContentOfPage" role="main">';
    }
    
    // Close the Genesis .content
    add_action( 'geodir_wrapper_content_close', 'pw_content_close', 11);
    function pw_content_close() {
    	echo '</main>';
    }
    
    // Removes opening and closing #geodir-sidebar
    remove_action( 'geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10 );
    remove_action( 'geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10);
    
    // Open the Genesis .primary-sidebar
    add_action( 'geodir_sidebar_right_open', 'pw_primary_sidebar_open', 10, 4 );
    function pw_primary_sidebar_open($type='',$id='',$class='',$itemtype='') {
    	echo '<aside class="sidebar sidebar-primary widget-area" itemtype="http://schema.org/WPSideBar" itemscope="itemscope" role="complementary">';
    }
    
    // Close the Genesis .primary-sidebar
    add_action( 'geodir_sidebar_right_close', 'pw_primary_sidebar_close', 10,1);
    function pw_primary_sidebar_close($type='') {
    	echo '</aside>';
    }
    
    ?>
    

    Inside functions.php added the following lines:

    
    
    //* Include WPGEO compatibility functions
    include( get_stylesheet_directory() . '/inc/wpgeo-compat.php' );
    

    I haven’t had time to fully test it out, but initial testing looks good. Hopefully you’ll find it useful.

    #7127

    Paul
    Expired Member
    Post count: 171

    Thanks for this John will give it a run out when I get some time and everything settles down with GD – sort of lost track with where GD is at at the moment 🙂

    #7238

    Paolo
    Site Admin
    Post count: 31206

    Hi John,

    great job!

    Thx

    #7748

    t c
    Free User
    Post count: 1

    Hi
    Thanks alot John. I’ve tried it running local host with wamp, but i’m having troubles.
    Warning: include(): Failed opening ‘C:wampwwwdirectory/wp-content/themes/minimum-pro/inc/wpgeo-compat.php’ for inclusion (include_path=’.;C:phppear’) in C:wampwwwdirectorywp-contentthemesminimum-profunctions.php on line 14

    i believe it is a problem with the relative path but i can’t seem to fix it.

    Thanks,
    Tom

Viewing 4 posts - 1 through 4 (of 4 total)

We have moved to a support ticketing system and our forums are now closed.

Open Support Ticket