Support » Plugin: Minimalistic Event Manager » Ordering post

  • Resolved AngeloLazzari

    (@angelolazzari)



    Hi i woild like to use your plugin but is there a way to order all the post of a specific category by the event start date?

    Than you very much

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Author Manuel

    (@targz-1)

    Hi Angelo,

    That’s a great question. First, here is a working example of code for what you want to do:

    function mem_category_order( $query ) {
      if ( $query->is_category('events') ) {
      
      	$query->set( 'meta_key', '_mem_start_date');
      	$query->set( 'orderby', 'meta_value');
      
      }
    }
    add_filter( 'pre_get_posts', 'mem_category_order' );

    https://gist.github.com/ms-studio/b3919690c95daaa1503ea9a949a0767d

    This example will order posts of the category with slug “events” by their start date.

    Caveat: this Category Archive will now only show articles that have a start date.

    Second, in the plugin’s wiki, there are some deeper considerations on how to handle archives and event dates:

    https://github.com/ms-studio/minimalistic-event-manager/wiki/Implementation-strategy

    Thank you very much Manuel!!! i will try it! thanks!

    Hi Manuel, i create this test site http://test.redtulp.com and i create 4 post too… 3 of the category events should be ordered by your code that i put in the funcion… but for some reason it’s not working,… i mean, it should be order the events by the start date ( that is the same date of the title ) …. but no…not working… you can see even the hello world post that is an uncategorized post….

    see here http://test.redtulp.com/eventos/

    thank you very much
    Angelo

    Moderator Geoffrey Shilling

    (@geoffreyshilling)

    Volunteer Moderator

    I have removed your offer to create an admin account on your test site. I understand it may be just a test site, but that’s still not a good thing to do. As Jan put it on another thread,

    The internet is a wonderful place full of very nice people and a few very bad ones. I’m sure everyone here is very nice however, by giving some ones keys to your house you are trusting they wont steal anything. Likewise the person who takes the keys is now responsible for the house FOREVER.

    so how i can comunicate with Manuel to solve the problem? thank you very much!
    Angelo

    Moderator Jan Dembowski

    (@jdembowski)

    Brute Squad and Volunteer Moderator

    Not that way. Please do not repeat that offer again. Honestly. The author will get into real trouble here for accepting that offer from you. Please so not make that offer again.

    https://wordpress.org/support/guidelines/#the-bad-stuff

    There are many ways to get information the author needs and that author accessing the user’s site is not one of them. That’s going too far.

    You get the idea.

    Volunteer support is not easy. But these forums need to a safe place for all users, experienced or new. Accessing their system that way is a short cut that will get you into real trouble in these forums.

    ok i got it thank you very much!!!

    Angelo

    Plugin Author Manuel

    (@targz-1)

    Hi Angelo,

    As the moderators said, please don’t post login info on this forum. Also, I don’t have time available to look into issues with such detail.

    That said, from what I can see on your test site, the custom ordering on the “Eventi” category page is actually working – see here:

    http://test.redtulp.com/category/eventi/

    In order to link to this page, the Menu builder allows you to use Categories as menu items.

    I hope this helps. I won’t be able to give you more specific advice, sorry.

    Best,
    Manuel

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Ordering post’ is closed to new replies.