Single event on page instead of blog post?
-
My single event pages show up as blog posts. I have a blog section on my site with breadcrumbs and events posts highlight the “blog” nav link and my breadcrumbs show up as Home-Blog-Event Title.
-
someone share this snippet which you can try or modify
add_filter('nav_menu_css_class', 'current_type_nav_class', 10, 2); function current_type_nav_class($css_class, $item) { $post_type = get_query_var('post_type'); if (get_post_type()=='event') { $current_value = "current_page_parent"; $css_class = array_filter($css_class, function ($element) use ($current_value) { return ($element != $current_value); } ); } if ($item->attr_title != '' && $item->attr_title == $post_type) { array_push($css_class, 'current_page_parent'); }; return $css_class; }
As for where to paste this : http://wp-events-plugin.com/tutorials/how-to-safely-add-php-code-to-wordpress/
Okay that works for the navbar not highlighting “Blog” but my bread crumbs still show up as “Home->Blog->Event Title”
But now the add new event and events submenus are gone. 😛
Are your breadcrumbs generated by your theme or via a plugin?
Can you post a link? That’ll make it easier to work out what’s happening with the navbar.
it’s been incorporated into the theme but was a plugin called “Simple Breadcrumb Navigation”
maybe you can try to check your theme breadcrumb for this and/or ask your theme provider for this issue since EM is custom post type.
I’d recommend Yoast Breadcrumbs (included in WordPress SEO plugin), as that is knwon to work well with EM.
Currently my pages are set up as follows:
Event List: Is on a page called “Training” with a shortcode to display the list of events. This is great no changes needed to this page.
Event Single: looks great except for the section right above the page which contains the page title and breadcrumbs. The theme (Sterling) uses a template part to display this. There is a woocommerce option I have tweaked were the page.php detects if the current page is the woocommerce product page and displays an alternative template part. I figure this same logic can be applied to the event single page. I’m just not sure how to write the conditional code since I’m a little shaky on my php coding.
Here is the conditional code that looks for the woocommerce product page and replaces the template part with the alternative “template-part-woocommerce-banner.php”:
// Check for WooCommerce. If true, load WooCommerce custom layout. if ( class_exists( 'woocommerce' ) && ( ( 'true' == is_woocommerce() ) || ( 'true' == is_checkout() ) || ( 'true' == is_cart() ) || ( 'true' == is_account_page() ) ) ) : ?> <section class="small_banner"> <?php get_template_part( 'template-part-woocommerce-banner', 'childtheme' ); ?> </section>
I’m using a child theme as well. So I can replace the modified page.php in the child theme directory. Just need help writing the “else if” code.
Thanks
Pyou can something like
is_event_page();
see /em-template-tags.php near the bottom for a list of ones you can use
Figured it out. I created my own template-part-banner and modified template:
<section class="small_banner"> <div class="center-wrap "> <p class="page-banner-heading">Training</p> <div id="banner-search"> <form method="get" class="searchform" action="http://www.mysite.com/"> <fieldset> <input type="text" name="s" class="s" value="Search..." onfocus="if(this.value=='Search...')this.value='';" onblur="if(this.value=='')this.value='Search...';" /> </fieldset> </form> </div><!-- end #banner-search --> <div class="breadcrumbs"><a href="http://www.mysite.com">Home</a> → <span class='breadcrumbs'><a href="http://www.mysite.com/training">Training</a> </span> → <span class='current_crumb'><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></span></div><!-- end .breadcrumbs --> </div><!-- end .center-wrap --> <div class="shadow top"></div> <div class="shadow bottom"></div> <div class="tt-overlay"></div> </section><!-- END content-container -->
Is there a way to get rid of the “Map not available” verbiage when an event has no physical address?
you can change that using template file at templates/placeholders/locationmap.php
http://wp-events-plugin.com/documentation/using-template-files/
- The topic ‘Single event on page instead of blog post?’ is closed to new replies.