Viewing 4 replies - 1 through 4 (of 4 total)
  • We don’t have any code the specifically makes use of Genesis actions/filters within the core plugin. Perhaps something else results in that action not being fired?

    Since it’s sounding like a problem with custom code and which in turn builds on a non-default theme (Genesis in particular isn’t really structured like other themes) it is a little difficult to help you out on this one, I’m afraid.

    Thread Starter ellebillias

    (@ellebillias)

    i worked it out myself – here is the code if anyone else is interested:

    create a folder in your theme called “tribe-events” and paste this code in to a file called “default-template.php”

    <?php
    //* Default Events Template - Genesis
    
    remove_action( 'genesis_loop', 'genesis_do_loop' );
    add_action( 'genesis_loop', 'eco_tribe_events_template' );
    
    function eco_tribe_events_template() {
    	echo '<article id="tribe-events-pg-template" class="entry">';
    	tribe_events_before_html();
    	tribe_get_view();
    	tribe_events_after_html();
    	echo '</article> <!-- #tribe-events-pg-template -->';
    }
    
    add_filter( 'genesis_build_crumbs', 'tribe_events_genesis_crumb_filter', 10, 2 );
    add_filter( 'genesis_single_crumb', 'tribe_events_genesis_crumb_single', 10, 2 );
    
    function tribe_events_genesis_crumb_filter( $crumb, $args ) {
    	global $post;
    
    	// Check for the event-archive class to grab the "archive" page
    	$classes = get_body_class();
    	if ( in_array( 'events-archive', $classes ) ) {
    		$event_archive = true;
    	}
    	// Grab archive crumb parameters
    	$archive_slug = get_option( 'eventsSlug', 'events' );
    	$archive_url = home_url( '/' ) . $archive_slug ;
    	$archive_title = to_title_case( $archive_slug );
    
    	if ( $event_archive == true ) {
    
    		$url   = get_home_url();
    		$link = sprintf( '<a href="%s" title="View %s">%s</a>', esc_attr( $url ), $args['home'], $args['home'] );
    
    		$crumbs[] = $link;
    		$crumbs[] = $archive_title ;
    		return $crumbs;
    	} else return $crumb;
    
    }
    function tribe_events_genesis_crumb_single( $crumb, $args ) {
    	global $post;
    
    	// Grab archive crumb parameters
    	$archive_slug = get_option( 'eventsSlug', 'events' );
    	$archive_url = home_url( '/' ) . $archive_slug ;
    	$archive_title = to_title_case( $archive_slug );
    
    	if( is_singular( 'tribe_events' ) ) {
    		$crumb = get_the_title();
    		return '<a href="' . $archive_url . '">' . $archive_title .  '</a>' . $args['sep'] . ' ' . $crumb;
    	} else return $crumb;
    
    }
    
    function to_title_case($title)
    // Converts $title to Title Case, and returns the result.
    {
    // Our array of 'small words' which shouldn't be capitalised if
    // they aren't the first word. Add your own words to taste.
    $smallwordsarray = array(
    'of','a','the','and','an','or','nor','but','is','if','then','else','when',
    'at','from','by','on','off','for','in','out','over','to','into','with'
    );
    
    // Split the string into separate words
    $words = explode(' ', $title);
    
    foreach ($words as $key => $word)
    {
    // If this word is the first, or it's not one of our small words, capitalise it
    // with ucwords().
    if ($key == 0 or !in_array($word, $smallwordsarray))
    $words[$key] = ucwords($word);
    }
    
    // Join the words back into a string
    $newtitle = implode(' ', $words);
    
    return $newtitle;
    }
    
    genesis();
    Barry

    (@barryhughes-1)

    Thanks for sharing!

    Perfect. This has really helped my integration of Genesis and the Events Calendar.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘genesis integration’ is closed to new replies.