Forcing layout using the genesis framework

Home Forums Calendar Products Events Calendar PRO Forcing layout using the genesis framework

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #31897
    Robert
    Participant

    Hi guys,

    This is a issue I’ve been having for a while and thought it time to continue it on the support forums.

    I have been attempting to set my events calendar up on the genesis framework so that the all event related pages use a ‘content-sidebar’ layout.

    Using the template tag ” tribe_is_event ” I have managed to force single events pages into layout but the calendar and list views pages are full width.

    I have used the following declarations in the functions.php for the single events but when I try the tags “tribe_is_month” and ” tribe_is_upcoming ” it hasn’t been having the same result.

    /*—————————————————————*/
    /* Set Custom Layouts
    /*—————————————————————*/
    add_filter(‘genesis_pre_get_option_site_layout’, ‘set_layouts’);
    function set_layouts($layout) {

    if ( tribe_is_event() ) {
    $layout = ‘content-sidebar’;
    }

    return $layout;
    }

    Any help would be really appreciated.

    Thanks

    #31903
    Jonah
    Participant

    Hi Robert,

    I work a lot with Genesis so I should be able to help you out. Have you tried these conditional checks to set the layout: https://gist.github.com/2415009

    I’ll double check things on my end to make sure these are still working with this function but let me know if the above helps.

    Thanks,
    – Jonah

    #31922
    Robert
    Participant

    Hi Johah,

    I’m not 100% confident about using the conditionals in the functions but have been trying this:

    add_filter(‘genesis_pre_get_option_site_layout’, ‘set_layouts’);
    function set_layouts($layout) {

    if ( tribe_is_event() || tribe_is_month() && !is_tax() ) {
    $layout = ‘content-sidebar’;
    }
    return $layout;
    }

    What I’m finding is that the single events and venues are being adjusted according to the content-sidebar layout but nothing yet happening to the calendar main.

    I will keep fiddling to see what happens with other combos but any guidance would be great.

    #31924
    Jonah
    Participant

    Hi Robert,

    After banging my head around a bit on this one I figured out you have to set the Events Template option to “Default Page Template” in Events > Settings > Template. Try that.

    – Jonah

    #31941
    Robert
    Participant

    Hi Jonah,

    You’re gonna hate me for this but…there are 2 issues which exist.

    1) My default layout is actually a 3 column “sidebar-content-sidebar” so default throws everything into that template.
    2) In activating this, for some reason my post-meta and info both show up on the event pages.

    #31948
    Jonah
    Participant

    Hi Robert,

    Sorry but you’ll need to work out those issues on your own. There’s a lot you can do in Genesis to customize your layouts however you want. So, you’ll need to use the Default Page Template and then change the layout to accomodate your 3 column layout. Good luck!

    – Jonah

    #32006
    Robert
    Participant

    Hi Johan,

    I appreciate all the help so far

    I took your last comment as a challenge and spent time trying to work it out, with success! However, getting the results were a little more complicated than I thought so let me post what I did for your’s and other’s reference:

    (genesis related)
    1) Ditched the 3 column layout for the entire site but kept it for the homepage with the following:
    /*—————————————————————*/
    /* Force layout on homepage
    /*—————————————————————*/
    add_filter(‘genesis_pre_get_option_site_layout’, ‘nagoyainfo_home_layout’);
    function nagoyainfo_home_layout($opt) {
    if ( is_home() )
    $opt = ‘sidebar-content-sidebar’;
    return $opt;
    }

    (events calendar related)
    Next, I set the template to “default page” as you suggested – As predicted everything now settled into a content-sidebar layout. (As the whole site now used this as default).

    However……..
    The problem still existed with post-info and meta showing on all event related pages. It seems the plugin pulls the single-post template from genesis and not the page-template. If it did pull the page template then the info and meta issues wouldn’t arise.

    To get rid of this, 2 things (for some unexplainable reason) were required.
    1) dig into the functions.php and add:
    /**Remove post meta and info from events*/
    add_action(‘genesis_before’, ‘remove_info’ );
    function remove_info() {
    if (tribe_is_month() || tribe_is_event() ) {
    remove_action( ‘genesis_before_post_content’, ‘genesis_post_info’ );
    remove_action( ‘genesis_after_post_content’, ‘genesis_post_meta’ );
    }
    }

    This removed the meta and post-info for the grid calendar and events upcoming list.
    However, info and meta still appeared on single events and venues. I tried various other template tags in the same conditional but it kept showing.

    Solution: CSS
    .events-single .post-meta, .events-single .post-info { display: none; }
    .single-tribe_venue .post-info, .single-tribe_venue .post-meta { display:none; }

    This got rid of the nuisance meta and info on the remaining pages.

    Questions Johan (if you have time)

    1) Instead of adding this to the CSS, do you know the template tags to use in the above functions to have it apply there instead?
    2) Also do you have any idea as to why the tags “tribe_is_venue()” and “tribe_is_event()” didn’t affect the meta and info in venue and single event pages?
    3) Finally, why did “tribe_is_event()” influence the events list page, when logically I assumed “tribe_is_upcoming” would be the tag to do this?

    #32069
    Jonah
    Participant

    Hi Robert,

    1. You’ll need to play around with the conditionals and/or remove_action functions to get it right.
    2. Those two functions simply check whether the current post type is tribe_venue or tribe_events respectively. It’s possible for some reason there’s an issue with the plugin and Genesis where this condition is not set properly. You may need to combine the functions with another check like is_single() to determine that you’re viewing the post type and it’s a single post. One tool that helps a lot with this is Debug Bar (http://wordpress.org/extend/plugins/debug-bar/) – you can look at all those variables to help you troubleshoot your code.
    3. Again, tribe_is_event() simply checks that the post type in the query is tribe_events which when on the calendar page returns true. So you need to do some combining of functions to check for whether or not you’re on the list page. I’ve found these to be reliable: https://gist.github.com/2415009

    I hope that helps!
    – Jonah

    #32323
    Robert
    Participant

    Thanks for the response Jonah.
    I’ll check out those conditionals and play around to see what works.

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Forcing layout using the genesis framework’ is closed to new replies.