WordPress.org

Ready to get started?Download WordPress

Forums

Events Manager
[resolved] Show events as regular posts (articles) (41 posts)

  1. lmsalgado
    Member
    Posted 2 years ago #

    Hi, I searched a lot but couldn't figure out how to show the events as regular posts.
    I need to show it in main blog page and also is the administratios panels just like all the other posts.
    Any help?
    Thanks

    http://wordpress.org/extend/plugins/events-manager/

  2. agelonwl
    Member
    Posted 2 years ago #

    you could try telling EM to display events as posts in the settings pages tab

  3. lmsalgado
    Member
    Posted 2 years ago #

    Thank you for your answer! But I did that, and altough the event behaves as a post, it does not show neither in the main page next to the regular posts, or the Posts section in the administration panel.

    Just to make it clear: I can see the event in the Events page, and in the Events section of the AP. I just wish to see it also as a regular post.

    Thank you

  4. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    you're confusing the purpose of this setting. It behaves like a post/page when showing the event, but this won't make the event an actual page or post, so it won't show in your page/post lists

  5. lmsalgado
    Member
    Posted 2 years ago #

    :)
    Yes, I know!
    But for my use I really needed it to show the events ALSO as actual posts...

    Any tip on how to do this?

    Thanks

  6. Colin Tedford
    Member
    Posted 2 years ago #

    You could try using a custom query on your front page, adding the Events custom post type in; there may be a plugin to manage this without getting into the code. I'm not sure how dates would be handled, though - I imagine they'd either show up right when you post them or on the day of the event. If you wanted to set a different date for it to appear, that might be tricky.

    I was hoping to get my events to automatically go in my main blog area too, but I think I'm just going to manually copy the content of each new event listing into a new blog post (or find a way to use the shortcodes), since it's not much work.

  7. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    You can hook into the WP_Query object and hooks and just add in the event post type ad Colin says.

    EM does one thing when a post is loaded into the loop, which is it changes the default published date to the start date of the event (does not change it in the actual $post object though).

  8. robinmchugh
    Member
    Posted 2 years ago #

    Hi there,

    I would find this modification useful too (to make events actual posts/pages and display them in those sections in the admin panel). I am slightly uncertain of the procedure though and any further details you could provide (if not too complicated) would be appreciated.

    I have accessed wp-includes/query.php but am not sure where to go from here.

    Thanks for creating such a great plugin.

  9. lmsalgado
    Member
    Posted 2 years ago #

    Thank you all for your tips.
    I just realized that the events are in a different table than real posts. I thought that by choosing the option to publish as post, the event would be a post, but no, its just a look alike. This may mean that the flexibility I wish is way to hard to achieve.
    It's a pitty since I really liked this plugin, but i think I'll look for another ones that may help my goal.

    Thank you all, I'll keep my attention on this forum, maybe someone has some ssecret recipe :-D

  10. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 2 years ago #

    @robinmchugh in the admin area, that'll never happen (you could do it, but you're asking for trouble), just not the way it works.

    Events are custom post types, they use the same posts table, but we also have an index table for searching events etc rather than using the WP_Query object

  11. robinmchugh
    Member
    Posted 2 years ago #

    Thanks for your response. I was slightly misleading by stating I wanted to see the events in the posts admin area. My main aim was to make my theme recognise the events as posts so they are displayed in the frontend in the theme's featured areas. Ie. To assign the EM events as a blog category which could be selected as a featured category in the theme options (or something to that effect).

    Would adding the event post type into the WP_Query help achieve this in any way?

    As far as I can see, an EM page will override a standard blog post with the same permalink, so a workaround (as I think Colin suggests) is to create "partner posts" for each event. I'm not working with too many events, so I may settle for that.

    Thanks.

  12. agelonwl
    Member
    Posted 2 years ago #

    @robinmchugh

    You can try this snippet, this will allow your theme to display events/cpt on your front-page by pasting it to your theme function (e.g. functions.php)

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( is_home() && false == $query->query_vars['suppress_filters'] )
    		$query->set( 'post_type', array( 'post', 'event' ) );
    	return $query;
    }

    Also, you can temporarily revert to TwentyEleven theme to see how it works.

  13. robinmchugh
    Member
    Posted 2 years ago #

    hi agelonwl, thanks for your suggestion.

    In TwentyEleven, the snippet does indeed cause the theme to display the events on the homepage but alas, not in my chosen theme (Organic Structure).

    This is probably due to the fact that the theme's options require a blog category to be specified for the three different featured content sections of the homepage (although 'all categories' still won't include events). Same with it's blog and portfolio page templates. So seems like it will require modification of the options file.

    I have approached Organic Themes for some further help with this.

    Thanks again.

  14. dwood7399
    Member
    Posted 1 year ago #

    @adelonwl

    I am also looking to show event posts in both the Event's page as well as the main Loop on my home page. I've added your function to my functions.php file, but the event's aren't showing in my main loop, even in TwentyEleven theme.

    Is there another adjustment I need to make to the loop itself?

    Thanks!

  15. agelonwl
    Member
    Posted 1 year ago #

    @dwood7399

    can you provide a sample link ? also, when using TwentyEleven theme did you set it to read your latest post at wp general > reading and your events as post.

  16. theyavvy
    Member
    Posted 1 year ago #

    has there been any development on this . I really need to assign a post category to my events so I can display them in my theme also

    Thanks
    Alan

  17. dwood7399
    Member
    Posted 1 year ago #

    Thanks adelonwl, I forgot I had changed the 'Reading' settings, they now show up in the twentyeleven theme.

    Unfortunately like robinmchugh I'm using an Organic parent theme that uses the Options Framework plugin to choose the categories to display on the home page. I think since it only allows me to choose categories, rather than custom post types, that is the issue, correct?

    Any ideas?

    Site is here: http://www.evolveboston.com/wp_themetest/

    Thanks!

  18. jeanjeana
    Member
    Posted 1 year ago #

    I think I have the same problem. I have been using Arthemia, and have been able to get events to show up as posts, using agelonwl's snippet... thank you!!

    However, I have no success trying to filter by categories. I have tried the following to no avail.

    <?php
    $the_query = new WP_Query( array ( 'post_type' => array( 'post, event'), 'category_name' => 'Headline', 'posts_per_page' => 2, 'category__not_in' => array(45,72,73)) );
    ?>
    
    		<?php while ($the_query->have_posts()) : $the_query->the_post(); ?>
  19. jeanjeana
    Member
    Posted 1 year ago #

    To clarify: when I say that the above code doesn't work, what happens is that none of my events show up when I use WP_Query.

    However, if I use the following snippet (agelonwl's plus category filter) with query_posts, my events show up, but I can't hide any of them by category.

    add_filter( 'pre_get_posts', 'my_get_posts' );
    function my_get_posts( $query ) {
    	if ( is_home() && false == $query->query_vars['suppress_filters'] ) {
    		$query->set( 'post_type', array( 'post', 'event' ) );
    		$query->set('category__not_in', array(45,72,73));
    	}
    	return $query;
    }

    Currently, my entire calendar posts on the blog, while I'd rather that event posts appear only a few at a time, as the date approaches. Even better, I'd like to be able to pick and choose which events show up on the front list, although the calendar should show all events. I thought I could do this by setting up an "Hidden" category and using Quick Edit to mark events as hidden or not.

  20. theyavvy
    Member
    Posted 1 year ago #

    using agelonwl's snippet works but alas not for the functionality we need. it would be wonderful if events could be normal posts with normal post type categories. :)

  21. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    that'll never happen (event = post), your best bet will be to make events look like posts.

    r.e. post categories, this is already possible, you just need to associate the post categories taxonomy with the event CPT.

  22. jeanjeana
    Member
    Posted 1 year ago #

    r.e. post categories, this is already possible, you just need to associate the post categories taxonomy with the event CPT.

    I'm sorry-- I don't know how to do that. It appears that event categories are stored in the terms table alongside of regular post categories. But in my example above, 72 and 73 are the cat ids of event categories, but somehow they aren't being filtered out-- though 45, a regular post category, is being properly filtered.

  23. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    probably because the EM category taxonomy is called 'event-categories', or stored as a constant EM_TAXONOMY_CATEGORY, it's not the post taxonomy

  24. triggame
    Member
    Posted 1 year ago #

    Thanks Marcus for the tip! This query worked for me:

    <?php
    $my_query = new WP_Query( array( 'post_type' => 'event',  'event-categories' => 'my-category-slug-name' ) );
    while ($my_query->have_posts()) : $my_query->the_post();
    ?>
    <div>
    <h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
    <div class="excerpt"><?php the_excerpt(); ?></div>
    </div>
    <?php endwhile; ?>
  25. moufles03
    Member
    Posted 1 year ago #

    Hi,

    I use agelonwl snippet to display events on front page.
    How can I select events to be displayed as "featured posts" plz ?

    Thanks in advance

  26. Marcus
    NetWebLogic Support
    Plugin Author

    Posted 1 year ago #

    you'd have to do this e.g. by assigning a category or a tag. Then, you can filter by either of these. Alternatively, you could add your own custom code to do this.

  27. moufles03
    Member
    Posted 1 year ago #

    I'll try with tags, thanks !

  28. Adam
    Member
    Posted 1 year ago #

    r.e. post categories, this is already possible, you just need to associate the post categories taxonomy with the event CPT.

    Can some one explain in complete novice terms how to do this or provide and example code?

  29. agelonwl
    Member
    Posted 1 year ago #

    @

    some useful links
    http://codex.wordpress.org/Taxonomies

    sample code, check @triggame post above

  30. hixen
    Member
    Posted 1 year ago #

    Sorry guys but I'm confused, how do you show your future events using a custom query?

    edit: I manage to show my events on the front page using a custom query, but they don't show in the right order.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic