Enfold Compatibility Code (please test)

This topic contains 19 replies, has 7 voices, and was last updated by  semperteneo 9 years, 9 months ago.

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

Open Support Ticket
  • Author
    Posts
  • #5913

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Hello Everyone,

    We have started doing our compatibility tests with popular themes, we are almost done with Enfold but would like some user feedback before we package this info a plugin or child theme.

    KNOWN BUGS:
    #1 location manager switcher not visible (fixed with next core release)
    #2 details page slider has larger borders (fixed with next core release)
    #3 Home map cat pins very large (fixed with next core release)

    INSTRUCTIONS
    #1 copy the code below to your child theme(or theme) functions.php (it should be in-between PHP brackets)
    #2 leave feedback with any bugs or suggestions.

    Thanks,

    Stiofan

    
    
    remove_action( 'geodir_wrapper_open', 'geodir_action_wrapper_open', 10 );
    add_action( 'geodir_wrapper_open', 'enfold_action_wrapper_open', 9 );
    
    //add_action( 'geodir_before_main_content', 'enfold_action_wrapper_open', 9 );// full screen map
    
    function enfold_action_wrapper_open(){
    echo "<div class='container_wrap container_wrap_first main_color ".avia_layout_class( 'main' ,false)."'>";
    echo "<div class='container template-blog '>";
    
    }
    // action for adding the wrapperdiv closing tag
    remove_action( 'geodir_wrapper_close', 'geodir_action_wrapper_close', 10);
    add_action( 'geodir_wrapper_close', 'enfold_action_wrapper_close', 11);
    function enfold_action_wrapper_close(){echo '</div></div><!-- content ends here-->';}
    
    // action for adding the sidebar opening tag
    remove_action( 'geodir_sidebar_right_open', 'geodir_action_sidebar_right_open', 10 );
    add_action( 'geodir_sidebar_right_open', 'enfold_action_sidebar_right_open', 10, 4 );
    function enfold_action_sidebar_right_open($type='',$id='',$class='',$itemtype=''){
    $sidebar_smartphone = avia_get_option('smartphones_sidebar') == 'smartphones_sidebar' ? 'smartphones_sidebar_active' : "";
    echo "<aside class='sidebar sidebar_right ".$sidebar_smartphone." ".avia_layout_class( 'sidebar', false )." units' ".avia_markup_helper(array('context' => 'sidebar', 'echo' => false)).">";
    echo "<div class='inner_sidebar extralight-border'>";
    }
    
    // action for adding the primary div closing tag
    remove_action( 'geodir_sidebar_right_close', 'geodir_action_sidebar_right_close', 10);
    add_action( 'geodir_sidebar_right_close', 'enfold_action_sidebar_right_close', 10,1);
    function enfold_action_sidebar_right_close($type=''){echo '</div></aside><!-- sidebar ends here-->';}
    
    // action for adding the content div opening tag
    remove_action( 'geodir_wrapper_content_open', 'geodir_action_wrapper_content_open', 10 );
    add_action( 'geodir_wrapper_content_open', 'enfold_action_wrapper_content_open', 9, 3 );
    function enfold_action_wrapper_content_open($type='',$id='',$class=''){
    echo "<main class='template-page content ".avia_layout_class( 'content',false )." units' ". avia_markup_helper(array('context' => 'content','post_type'=>'page','echo'=>false))." ".$class.">";
    }
    
    // action for adding the primary div closing tag
    remove_action( 'geodir_wrapper_content_close', 'geodir_action_wrapper_content_close', 10);
    add_action( 'geodir_wrapper_content_close', 'enfold_action_wrapper_content_close', 11);
    function enfold_action_wrapper_content_close(){echo '</main>';}
    
    add_action( 'geodir_wrapper_open', 'enfold_detail_title', 8,2 );
    function enfold_detail_title($page,$class){
    	//echo '###'.$page;
    	if($page=='details-page'){
    		add_action( 'avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8,2 );
    		echo avia_title();
    	}elseif($page=='listings-page' || $page=='search-page'){
    		add_action( 'avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8,2 );
    		ob_start() ; // Start buffering;
    		geodir_action_listings_title();
    		$gd_title = ob_get_clean();
    		$title_p = explode('">',$gd_title);
    		$title = str_replace('</h1></header>',"",$title_p[2]);
    		//print_r($title_p);
    		echo avia_title(array('title' => $title));
    	}elseif($page=='author-page'){
    		add_action( 'avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8,2 );
    		ob_start() ; // Start buffering;
    		geodir_action_author_page_title();
    		$gd_title = ob_get_clean();
    		$gd_title = str_replace('<h1>',"",$gd_title);
    		$gd_title = str_replace('</h1>',"",$gd_title);
    		echo avia_title(array('title' => $gd_title));
    	}elseif($page=='add-listing-page'){
    		add_action( 'avia_breadcrumbs_trail', 'enfold_detail_breadcrum', 8,2 );
    		echo avia_title();
    	}
    }
    
    function enfold_detail_breadcrum($trail, $args ){
    	ob_start() ; // Start buffering;
    		geodir_breadcrumb();
    		$gd_crums = ob_get_clean();
    		if($gd_crums){
    		$gd_crums = str_replace('<div class="geodir-breadcrumb clearfix"><ul id="breadcrumbs"><li>',"",$gd_crums);
    		$gd_crums = str_replace('</li></ul></div>',"",$gd_crums);
    		$gd_crums = str_replace('</li><li>',"",$gd_crums);
    		$gd_crums = explode(" > ", $gd_crums);
    		$trail_end = array_pop($gd_crums);
    		$gd_crums['trail_end']=$trail_end;
    		//print_r($gd_crums);
    	//print_r($trail);
    	$trail = $gd_crums;
    		}
    		return $trail;
    }
    
    ##############################################
    ########### LISTINGS PAGE ####################
    ##############################################
    remove_action( 'geodir_listings_before_main_content', 'geodir_breadcrumb', 20 );
    remove_action( 'geodir_listings_page_title', 'geodir_action_listings_title',10);
    ##############################################
    ########### DETAILS PAGE #####################
    ##############################################
    remove_action( 'geodir_detail_before_main_content', 'geodir_breadcrumb', 20 );
    remove_action( 'geodir_details_main_content', 'geodir_action_page_title',20);
    ##############################################
    ########### SEARCH PAGE ######################
    ##############################################
    remove_action( 'geodir_search_before_main_content', 'geodir_breadcrumb', 20 );
    remove_action( 'geodir_search_page_title', 'geodir_action_search_page_title',10);
    ##############################################
    ########### AUTHOR PAGE ######################
    ##############################################
    remove_action( 'geodir_author_before_main_content', 'geodir_breadcrumb', 20 );
    remove_action( 'geodir_author_page_title', 'geodir_action_author_page_title',10);
    #5920

    directory
    Expired Member
    Post count: 1502

    Thank you, Stiofan.

    #5987

    purpleedge
    Expired Member
    Post count: 539

    Hi Stiofan, Thanks, can you add it to the post as a txt file attachment please?

    #6051

    semperteneo
    Free User
    Post count: 39

    anybody have a live demo of this?

    #6078

    semperteneo
    Free User
    Post count: 39
    This reply has been marked as private.
    #6081

    semperteneo
    Free User
    Post count: 39

    Popular categories on home page map while on mobile (iOS) has overlapping text.

    #6484

    Tony Mattioli
    Expired Member
    Post count: 58

    Curious to know if Avada and Jarada are in the plans, looking forward to the documentation.

    #6487

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    Avada is in the pipeline, i might get some test code out today

    Thanks,

    Stiofan

    #6493

    Stiofan O’Connor
    Site Admin
    Post count: 22956

    As far as i can see avada seems to be ok by default, not perfect but almost.

    Stiofan

    #6650

    identity
    Lifetime Member
    Post count: 445

    How best to use this with a child theme?

    I ask because I initially copied the code into the end of the Enfold child theme functions.php file, which was a straight copy of the parent version, however that started throwing errors just trying to activate. Those errors appeared to be related to the actual Enfold code, so I assumed that it didn’t like getting the same code twice.

    I then stripped out all of the Enfold code and pasted in the compatibility code. At that point it seemed to work fine, but when I tried deleting some of the other themes I had, new errors popped up:

    Warning: Cannot modify header information – headers already sent by (output started at /home/mysite/public_html/c/wp-content/themes/enfold-child/functions.php:1) in /home/mysite/public_html/c/wp-includes/pluggable.php on line 1121

    It did appear to remove the other themes anyway.

    Just not sure if this code expects to be called after the Enfold code (at the end of the functions.php file) is parsed, which may be a problem with this child setup…I’m assuming part of that issue is that Enfold needs to fix their code so that a copy of the functions.php file into a child-theme shouldn’t break anything.

    Clear as mud?

    Cheers

    #6657

    John Allsopp
    Expired Member
    Post count: 399

    I think Stiofan is going to be packaging these as plugins, but in the meantime if you want to add the code yourself, i normally add a new php file, then do an include from my functions.php – something like this:-

    Create a folder in your child theme called includes

    
    
    <?php
    
    // Stiofan's code here
    
    ?>

    Save the code above as wpgeo-compat.php (inside the includes folder you just created)

    Then in your functions.php file, add the following line

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

    identity
    Lifetime Member
    Post count: 445

    Thanks John, I’ll try that.

    I don’t have a ton of expertise in WP yet, so I wasn’t entirely sure whether it was a me issue, a Enfold issue, a WPGeo issue, or some combination there of.

    Either way, hopefully all can be configured at some point for a safe child-theme isolation to help avoid potentially breaks with updates, especially when you start layering on multiple themes and plugins.

    That said, the more I think about WP’s whole child-theme thing, while it is better than nothing, it really seems to be more of a poor-man’s SVN…at which point it may be just as easy to do a file compare and merge.

    cheers,
    Brian

    #6714

    identity
    Lifetime Member
    Post count: 445

    Struggling here a little bit.

    Feels more like two themes rather than a theme and plugins. With Enfold, I see that I have the ability to really custom create just about any look and feel to the pages I could imagine thanks to the Advanced Editor. And then with GD, I have the engine to power the site, but seems more like they run parallel rather than intertwined.

    Maybe I’m missing something or don’t have things setup right, but what I’m looking for is the ability to craft my pages with Enfold and pull in GD content where and how I want it.

    I’m assuming that this is where the shortcodes will come in? Am I wrong in that assumption? Is there a list of shortcodes yet?

    Cheers,
    Brian

    #6736

    purpleedge
    Expired Member
    Post count: 539

    Hi Brian,

    The Enfold child theme functions.php should be an almost empty file, until you add the GD mods. You shouldn’t copy the original Enfold functions.php file to your child theme.

    My version is attached, which has an additional function to bypass the loading of Google Maps API by Enfold – provided by Stiophan.

    I hope we are able to use shortcodes as you describe; I’m hoping for clarification too.

    #6742

    identity
    Lifetime Member
    Post count: 445

    @purpleedge

    Thanks, I’ll take a look.

    Cheers

Viewing 15 posts - 1 through 15 (of 20 total)

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

Open Support Ticket