• Here is a bit of code I used to get around Events Manager’s way of doing single events so the plugin will work with Yoast SEO’s breadcrumb function. It is not 100% foolproof but it works well enough for what I needed. I use it in header.php of my theme.

    <?php
        //check if breadcrumbs and events manager functions exist
        if (function_exists('yoast_breadcrumb') && !is_front_page()) : ?>
        <div id="breadcrumb_wrapper" class="clearfix">
          <?php
              // set your before and after tags for breadcrumbs
              $bc_start = '<nav id="breadcrumbs"><div>';
              $bc_end   = '</div></nav>';
    
              // if is one of your pages that have events manager
              if ( ( is_page('Events') || is_page('Past Events') ) && function_exists( 'em_init' ) ) {
                  // events calendar class
                  global $EM_Event;   
    
                  // get yoast options from database which can be set in yoast internal links settings page
                  $opt = get_option("wpseo_internallinks");
                  $bc_sep = $opt['breadcrumbs-sep'];
                  $bc_home = $opt['breadcrumbs-home'];                                      
    
                  if ( em_is_event_page() ) { // single event conditional
                    $this_page = '<a href="'.site_url().'">'.$bc_home.'</a> '.$bc_sep.' <a href="'.get_permalink().'">'.get_the_title().'</a> '.$bc_sep.' <strong>'.$EM_Event->output('#_NAME').'</strong>';
                    echo $bc_start.$this_page.$bc_end;
                  } else {  // multi events list conditional
                      echo $bc_start.'<a href="'.site_url().'">'.$bc_home.'</a> '.$bc_sep.' <strong>'.get_the_title().'</a></strong>'.$bc_end;
                  }
              } else { // do yoast bc function
                  yoast_breadcrumb( $bc_start, $bc_end );
              }
          ?>
        </div>
    <?php endif; ?>
Viewing 11 replies - 1 through 11 (of 11 total)
  • Thread Starter gojsse

    (@gojsse)

    You must have yoast seo and events manager installed.

    Set your Home and breadcrumb separator in the Yoast internal links setting page.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    nice, thx for sharing!

    will this fix the event date picker issue?

    Thread Starter gojsse

    (@gojsse)

    No, it’s purely for customizing your yoast breadcrumbs to work with events manager a little better.

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    event date picker issues are probably due to a theme/plugin conflict.

    Thanks for sharing this!

    Question: Yoast SEO points all the URLs on my events manager event search page to mydomainname.com/events, thereby preventing users from seeing the actual event posts. Would your solution address that or is this a different problem?

    Thanks,
    Kelly

    Thread Starter gojsse

    (@gojsse)

    My workaround is just for adding another link after the events page link so it looks and acts more like you are viewing a single post.

    Example, without the workaround, the breadcrumbs would do this even if you are viewing a single event:

    home >> events

    The code I made simply adds the currently viewed event at the end like this:

    home >> events >> currently viewed event name

    So, it doesn’t address the search portion nor does it hook into any functions for yoast or events manager.

    I see. Thank you so much for the quick reply!

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    i won’t bother with this stuff simply because if I work on making events posts it’ll solve this.

    Marcus,

    Cool. Is that something you plan to do within the next four months? If so, I’ll hold off on hiring a developer to integrate the two plugins.

    Thanks,
    Kelly

    Plugin Author Marcus (aka @msykes)

    (@netweblogic)

    yes, 4 months should be plenty

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘Yoast Breadcrumbs (SEO) and Events Manager fix’ is closed to new replies.