• Resolved Hans Schuijff

    (@hanswitteprins)


    Hi,

    I have installed this plugin in conjunction with the genesis framework and the essence pro child theme (Studiopress). The install runs on php version 7.2.6.

    To make it work I’ve had to used snippets from the Genesis theme framework integration since it doesn’t work otherwise. But they seem to make it work.

    One of the snippets is used to suppress the Genesis Author Box, but it generates warnings in the php log on the condition (the query-part refering to the single venue and the single organizer page). Is it possible to make it work without the warnings, perhaps by using one of the wp-conditionals instead?

    The warning says: Undefined index: post_type
    Pointing to: || $query->query['post_type'] == 'tribe_venue' || $query->query['post_type'] == 'tribe_organizer'

    Also the Essence Pro theme moves the title normally in hero-header and shows it big over an here-image. For that to work it has to remove the current title and insert in the header. Since the genesis loop is basically disabled to show the event-content, this doesn’t function. Does TEC offer a hook to show/not-show the title, that allows me to remove/add it to a different place?

    Thanks,
    Hans

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi @hanswitteprins,

    Thanks for your interest in our products.

    For the Genesis integration and loop, I’ll have to look into that a bit further — I’ll update here with what I find!

    Your second question regarding the title hook, we do have helper functions. You can easily remove with help from this page → https://theeventscalendar.com/knowledgebase/altering-or-removing-titles-on-calendar-views/

    But I would suggest doing this with custom templates. You can learn all about overriding templates and styles → Themer’s Guide

    In this case, you may want to explore custom page templates.

    Hope that helps!

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    Hi Ed,

    Thanks for your response.

    I found it easiest, for now, just to work with custom templates, although I have found in the past templates tend to age sooner then expected so I often rather use hooks and functions instead.

    Aside: A bit burdersome that your documentation shows such an extended list of deprecated functions, making it more work to find the current ones. Might it be an idea to separate or filter them, since I imagine we need to use only the not-deprecated functions anyway?

    I wasn’t yet able to set the correct table in the essence pro header, since the essence pro hook essence_entry_header is hooked on the genesis_before_header hook, instead of the genesis_entry_header hook. I’m guessing that not all titles are available yet at that point.

    So single event pages don’t have a title in the theme’s header yet, since the_title() is still empty at that point and tribe_get_events_title() is showing something generic rather than the single event’s title. And the archive titles are also not always the same at this hook (photo view shows the wrong end date f.i.). So it probably needs to be called from within the loop, or something. I understand that this is customization and not the target of your support, so I will puzzle some more myself.

    For what it’s worth I also used another workaround to make TEC display right in Genesis, rather then using the code in the genesis integration guide to be used when the archive settings disturb the correct display of TEC archives. You’ll find the code at the bottom here.

    I opted for code that forces the archive settings for specifically the TEC archive pages. In doing that there was no need to remove standard genesis code and it could always be added so whatever settings are set, it always works. Probably the only setting that was needed was setting the “limit content to” option to 0, but this works. Other options, when needed, can of course be forced too.

    Props to WP Beaches and the blog article Changing the Genesis Archive Page Settings for Custom Post Types.

    add_action('genesis_before_loop','tvu_TEC_set_genesis_for_events_display');
    
    function tvu_TEC_set_genesis_for_events_display() {
    
        if ( class_exists( 'Tribe__Events__Main' ) ) 
        {
            // when TEC Pro is active, 
            // check if current page is a standard TEC archives view
            if (  tribe_is_month() 
               || tribe_is_upcoming() 
               || tribe_is_past() 
               || tribe_is_day() ) 
            {
                // force genesis archives options for correct display of TEC content
                tvu_force_TEC_genesis_content_archives_options();
            } elseif ( class_exists( 'Tribe__Events__Pro__Main' ) ) 
            {
                // when TEC Pro is active, 
                // check if current page is a standard TEC Pro archives view
                if (  tribe_is_map()
                   || tribe_is_photo()
                   || tribe_is_week()
                   || ( tribe_is_recurring_event() && ! is_singular( 'tribe_events' ) ) )
                {
                    // force genesis archives options for correct display of TEC content
                    tvu_force_TEC_genesis_content_archives_options();
                }
            }
        }
    }
    
    function tvu_force_TEC_genesis_content_archives_options() {
    
        // Set layout to full-width
        add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
    
        // Set display option to full content
        add_filter( 'genesis_pre_get_option_content_archive', 'tvu_cpt_change_content' );
    
        function tvu_cpt_change_content() 
        {
            return 'full';
        }
    
        // Set limit content to option to 0 characters
        add_filter( 'genesis_pre_get_option_content_archive_limit', 'tvu_cpt_change_content_limit' );
    
        function tvu_cpt_change_content_limit() 
        {
            return 0;
        }
    
    }
    

    Nice work there! I’m sure that others will find this useful as well.

    I agree with the deprecated functions, I’ll pass this on and also see if we can get rolling with some more Genesis support.

    Take care,
    Ed ??

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    I’ve changed the snippet for removing the author box from single templates, as provided on the genesis framework integration support page, to use the standard TEC conditionals. That seems to work too and might solve the warnings generated by the original snippet. Don’t know if there are scenario’s not covered by the new code, and perhaps the hook may change now, but it removes the author box on my pages and looks a lot cleaner.

    /*
     *
     * Genesis Remove Author Box from Single Templates for the The Events Calendar
     *
     */
    add_action( 'pre_get_posts', 'tribe_genesis_hide_author_single_events' );
    function tribe_genesis_hide_author_single_events( $query ) {
    
        if ( tribe_is_event() || tribe_is_venue() || tribe_is_organizer() ) {
    
            remove_action( 'genesis_after_entry', 'genesis_do_author_box_single', 8 );
    
        }
    }

    Also I seem to more or less solved the title thing in Essence pro, be it that it only seems to work since I have used a few widgets using the genesis featured page widget. Putting the title below those widgets solved my problem. Don’t know why functions like get_the_title() return empty when I don’t, since the template addresses them outside the loop too, but mostly it seems to work now. Only the end-date in the title when using the photo view keeps being the same as the start-date, but I can live with that for now.

    Hope it helps.

    cheers,
    Hans

    Awesome! I’ll check out your snippet, may be time to update that compatibility article.

    Thanks for sharing your finds!

    Thread Starter Hans Schuijff

    (@hanswitteprins)

    My pleasure.

    I can imagine a wrapper-if being added, to handle when TEC isn’t active, but for me it works like this.

    Cheers,
    Hans

    ps. While you’re thinking of renewing the page… why not just make a genesis-connect-events-calendar plugin instead, if genesis is a target audience? It has been done for plugins like WooCommerce and WooThemes Sensei and TEC could fit in that connect-series just fine. ?? Just a thought.

    • This reply was modified 6 years, 7 months ago by Hans Schuijff.
    Barry

    (@barryhughes-1)

    That’s definitely something we’ll consider ??

    Hey there,

    Since this thread has been inactive for a while, I’m going to go ahead and mark it as resolved. Don’t hesitate to create a new thread any time you help again!

    Ed ??

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Genesis Integration leads to php warnings’ is closed to new replies.