WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] [Plugin: The Events Calendar] Showing the Events on the home page (34 posts)

  1. Jonas Grumby
    Member
    Posted 2 years ago #

    Just wondering if anyone has come up with a solution as to how you can show the TEC events on your home page and still display the calendar correctly.

    I also find that Posted in <?php the_category(', ') ?> shows links to the regular post categories but not the events categories and would appreciate it if anyone has code that will show a link to either the post category or the event category as needed.

    Seems like links to events don't show up under Recent Posts either. Any thoughts on that?

    I know that all of the above is because the new version of the plugin uses custom post types instead of post categories.

    Other issues I am having are:

    If I set a Featured Image it shows up on the single post page full-size above the post and again in the post with the size & placement that I have specified.

    The Google link works fine but the Google map is way too zoomed out.

    I am using plugin version 2.0.1, a custom theme, and the most recent version of WordPress.

    Thanks!

  2. Jonas Grumby
    Member
    Posted 2 years ago #

    If I set a Featured Image it shows up on the single post page full-size above the post and again in the post with the size & placement that I have specified.

    This can be fixed by removing these lines:

    <?php
    
    	if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {?>
    
    		<?php the_post_thumbnail(); ?>
    
    	<?php } ?>

    from /wp-content/plugins/the-events-calendar/views/single.php

    I guess there is also a way to make copies of the plugin's templates so that you can edit the copies and not lose your changes during an automatic upgrade. At least it was that way with older versions of the plugin.

  3. Jonas Grumby
    Member
    Posted 2 years ago #

    This seems to be working for me in terms of showing the events on the home page and not messing up the calendar display.

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
      if(is_category() || is_tag() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
        $post_type = get_query_var('post_type');
    	if($post_type)
    	    $post_type = $post_type;
    	else
    	    $post_type = array('post','tribe_events','attachment');
        $query->set('post_type',$post_type);
    	return $query;
        }
    }

    http://shirleyandthemastics.com/

  4. Shane Pearlman
    Modern Tribe
    Posted 2 years ago #

    Jonas, you rock!!! I've updated the post on the blog.

  5. Jonas Grumby
    Member
    Posted 2 years ago #

    No problemmo. Glad I could help. Thanks for the awesome plugin!

  6. Jonas Grumby
    Member
    Posted 2 years ago #

    In retrospect you would probably be better off using is_archive() than is_category() because while is_category() will make your old category link work, it will only show the old events that were entered before upgrading to TEC version 2.0.

  7. andywaterson
    Member
    Posted 2 years ago #

    I added this code to my functions.php file and noticed that when you go to any category page the top navigation has been removed.

    Shane - will this option be included in upcoming releases of the events-manager plugin? And is this option included in the Events Pro version?

  8. Jonas Grumby
    Member
    Posted 2 years ago #

    Hi @andywaterson,

    It's possible that this is being caused by your theme. When you have a chance, please switch to the default theme temporarily and LMK if the problem goes away.

  9. andywaterson
    Member
    Posted 2 years ago #

    I've tried this on other themes than the one I'm using and it happens on all of them. Also tried it on the Twenty Eleven 1.2 theme and the Twenty Ten 1.2 both of these themes do not show the WordPress navigation when clicking onto a category page.

  10. Steve
    Member
    Posted 2 years ago #

    Have used Jonas solution above - thank you, appears to kind of work on my theme but the formatting between real posts and calendar posts has lots it's grey seperation bar.

    Here's the site address - any help appreciated!

    http://www.merchistounhall.co.uk

    Anyway, great plugin - hope it can be expanded to include this post/calendar function natively.

  11. Jonas Grumby
    Member
    Posted 2 years ago #

    @andywaterson - I'm using wp_list_pages to generate a pages menu and it works fine with that hack. I will take a look at Twenty Ten & Twenty Eleven to see what they are using.

    @supersonic - I only see one gray horizontal line at the top of all of the posts. It appears to be coming from

    div.post, div.page {
        border-top: 4px solid #EEEEEE;

    OTTOMH I would say that you either need to apply that CSS to the TEC post ID or class attributes in the CSS, or add the line to the php template inside the loop (at the very beginning or end). If you do the latter you should remove the border info from the CSS or you may end up with a double border on non-event posts.

    Yet another solution might be to make your template non-exclusive.

    Right now the code reads:

    <div id="post-2636" class="post-2636 post type-post status-publish format-standard hentry category-merchistoun-news odd">

    With post type-post in there, the CSS rule is only being applied to posts that have the default post type. It may be pretty simple to remove that.

  12. Jonas Grumby
    Member
    Posted 2 years ago #

    Seems like this problem may be related to custom post types in general and not just the plugin...

    http://wordpress.org/support/topic/adding-custom-post-type-to-the-loop-wp-nav-menu-dissapears?replies=7

  13. Jonas Grumby
    Member
    Posted 2 years ago #

    Having played w/ custom post types a bit, it's interesting to note that it's pretty easy to set a custom post type to support tags & categories (as well as taxonomies).

  14. Steve
    Member
    Posted 2 years ago #

    Thank you for trying to help me Jonas and taking the time to post - I am afraid that the ongoing tweaking required is going to outweigh the benefits of using this plugin.

    Enjoyed using this plugin in it's previous form - afraid 2.x is a bit of step in the wrong direction.

    Thankfully my events finish at the end of the year.

    Going to give http://wordpress.org/extend/plugins/events-manager/ a spin in my dev. environment as it seems to offer much more (at least on their glossy website!).

    Thanks again.

  15. bwp
    Member
    Posted 2 years ago #

    Good luck, supersonic. I've been looking at them too. Their subforum here is pretty active. There's also a fork of their older version called Events Made Easy.

    Note, however, that they're moving to the same custom-posts-type format as TEC 2.x!

    And this is why I'm still at unsupported TEC 1.x.

  16. Jonas Grumby
    Member
    Posted 2 years ago #

    I think it's safe to say that custom post types are here and we are all having to figure out how to deal with them. They are great when you have a specific reason for keeping certain posts out of the main posts loop. I still don't understand what was gained by making this plugin use a custom post type. Certainly they lost the "plug-n-play" aspect that this plugin used to have, which I think is important to any public theme or plugin. The plugin does work well, especially if you can figure out all the ins and outs of how to make it display when, where, and how you want it to. Luckily custom post types are a WordPress core feature, so there is plenty of documentation and forum chat that you can read about them.

  17. Shane Pearlman
    Modern Tribe
    Posted 2 years ago #

    We have certainly heard the open source communities desire for a more complete integration between events and posts and will be working on ideas to help as part of 2.1.

  18. Shane Pearlman
    Modern Tribe
    Posted 2 years ago #

    @bwp / jonas - wondering is an options in settings like "Show events in main post loop" would help most of the frustrated users? Not sure the implications as this starts messing with theme territory, but if there is enough aye aye's then we'll look into it.

  19. Jonas Grumby
    Member
    Posted 2 years ago #

    Hi Shane,

    I think a setting like "Show events in main post loop" would be great. It would also be great if the TEC custom post type could support tags, which shouldn't be difficult to do and would allow people an alternative to querying by category. Those who want certain event and non-event posts to be able to be grouped together could query by tag.

    Thanks

  20. Shane Pearlman
    Modern Tribe
    Posted 2 years ago #

    Yup, tags is already handled in 2.1 (we are coding away). We decided to go with proper tags rather than a unique taxonomy for the exact reason you mentioned.

  21. bwp
    Member
    Posted 2 years ago #

    Well, for me it's more about categories -- I don't even SHOW a post loop on the home page (other than via widgets). So I guess that "Show events in main post loop" wouldn't really help me much?

    But I guess my widgets (e.g., recent posts by category) might benefit? Not sure. Handsomeman provided a category hack that seems promising.

    I don't really grok the difference between tags and categories, other than that categories seem a lot more useful in WordPress.

  22. Jonas Grumby
    Member
    Posted 2 years ago #

    You can actually write your own code and put it in the PHP widget. I posted some code for a Recent Events widget here:

    http://wordpress.org/support/topic/plugin-the-events-calendar-template-tag-help-please?replies=5

  23. bwp
    Member
    Posted 2 years ago #

    Which is great (and admirable) but then becomes something that I need to become responsible for wherever I add it, living through upgrades, informing site owners, etc. It gets away from the easy parts assembly I thought the plugins and widgets were supposed to represent... At some point we'd have to ask whether it makes sense to use a "plug-in" that required so much manual tweaking, especially when right now the deprecated version still works so seamlessly for us...

    Don't get me wrong, Jonas, I much appreciate the code / idea. Thanks.

  24. Shane Pearlman
    Modern Tribe
    Posted 2 years ago #

    @bwp - updated internal notes to have a setting called "Show events in post loop". So there they will show in main / cat / tag / archive ...

    =) if there are no unsurmountable technical hurdles, it sounds like this should get you where you wanted?

  25. Jonas Grumby
    Member
    Posted 2 years ago #

    Also keep in mind that my code example does not contain any code that is specific to this plugin. It's all standard WordPress code and therefore there is no reason why you would have to maintain it unless you wanted to make some cosmetic changes of your own choosing.

  26. Jonas Grumby
    Member
    Posted 2 years ago #

    Also keep in mind that the plugin does come with widgets. I really wrote that for a site that does not use widgets.

  27. andywaterson
    Member
    Posted 2 years ago #

    @Jonas Grumby
    Thanks for the link it had the info I needed to display the menus and the events on the homepage.

    add_filter('pre_get_posts', 'query_post_type');
    function query_post_type($query) {
    if(is_archive() || is_tag() || is_home() && empty( $query->query_vars['suppress_filters'] ) ) {
    $post_type = get_query_var('post_type');
    if($post_type)
    $post_type = $post_type;
    else
    $post_type = array('post','tribe_events','attachment','nav_menu_item');
    $query->set('post_type',$post_type);
    return $query;
    }
    }

    Added 'nav_menu_item' in the $post_type = array
    Thanks!

  28. bwp
    Member
    Posted 2 years ago #

    Thanks guys, but Shane I'm a bit confused by your last comment. Just including the events in the post loop will make their corresponding categories usable in non-TEC contexts? I thought I'd still need something like handsomeman's hack in order to do anything useful with categories and TEC 2.x. (I've described this before, but I just use multiple category assignments to make a single event/post appear in multiple listings and under multiple menus along with other normal posts and galleries that are related to that post/event.)

  29. bwp
    Member
    Posted 2 years ago #

    Shane? Rob? This thread may scroll away pretty soon...

  30. Nick Bumgarner
    Member
    Posted 2 years ago #

    I was hoping somebody might be able to give me a quick answer to a more vague question regarding this topic.

    If I want to just display the Month View Calendar on the home page, what file do I need to add the template tag to and in what format?

    I understand that there are various template tags for this plugin, but I'm not even really sure where it goes.

    (I'm hoping the green will start coming off sooner or later)

Topic Closed

This topic has been closed to new replies.

About this Topic