WordPress.org

Ready to get started?Download WordPress

Forums

Future events category & anotated calendar working! (23 posts)

  1. mcmartin
    Member
    Posted 8 years ago #

    Hello,

    Thanks to reading lots of posts here, reading lots of the codex, the View Future Posts Plug-in, and making a modified version of the EventCalendar2 Plugin, I've finally made the events calendar I wanted. It uses a customized category-2.php. It first shows a running n-month (6 month in my case) calendar with event dates highlighted and linked. Then the page goes on to list Future events (only those after $now), and finally links to Past events.

    I use the same future/past test to make my home page show only Future events, and get the tense correct for 'is scheduled for' or 'occurred on' date at the bottom of the individual posts.

    Please check it out at my still developing site: http://thznetwork.org/wordpress/index.php/archives/category/conferences-etc/
    and feel free to use some of these mods yourself by looking at the codes. I'll try to help if I can.

    One note, I'm having a problem getting Internet Explorer to render the top of my site correctly as I've posted here. Everything works fine with FireFox. If you have any suggestions for how I can fix this, please respond to that post!

    Hope this is useful! -Mike

  2. sinus
    Member
    Posted 8 years ago #

    Hi Mike,
    sounds really cool ... and looks great.
    But how can I do the same??
    I am afraid, I cannot do this by myself :(
    Thanks for any help
    Markus

  3. DianeV
    Member
    Posted 8 years ago #

    That is really nice, Mike. Nice implementation.

  4. mcmartin
    Member
    Posted 8 years ago #

    Thanks for the kind replies. I continue to tweak and like the page.

    Oh, and that IE error I noted is now fixed (or at least I found a good enough work-around).

    I haven't yet tried to make the changes to eventcalendar2 all foolproof, but I wouldn't think it's be too hard to pass another variable to a new version of this plugin which would allow muiltiple months to be displayed wide (like I've done), or an a collum (like the default for putting a calendar in the sidebar). You can look at the modified plug-in code here:
    http://thznetwork.org/wordpress/wp-content/plugins/eventcalendar2+MCM.php.txt
    but I have not fully commented the changes or tried to make the changes universally use-able. I guess if there was sufficient interest it wouldn't be too hard to make a modified version of this plug-in with a little more robust descriptions and codings.

    I of course also made a custom category-2.php file to give it the correct look and separate out future from past events in the list at the bottom. And changed the colors for the table entries to better highlight the event days in the styles.css file.

  5. sinus
    Member
    Posted 8 years ago #

    Mike, thanks a lot for this.
    I tried to paste your eventcalendar2+MMC.php in the Plugin-folder and changed in my sidebar the line
    <?php get_calendar(); ?>
    into your new
    <?php get_event_calendar(X); ?>

    In my case into
    <?php get_event_calendar(13); ?>

    But then I could not activate your plugin although it was on the list in WordPress to activate.

    Hence I guess, I do something totally misunderstand.
    Must I first "install" eventcalendar2??
    In this case I have to read this.
    Or do you have an easy step-by-step - "manual".
    I guess only, that some part of my misunderstanding is also my bad Englisch, sorry for this.

    I you or some of other user would be so kind and explain this to such a novice like me, it would be great and very friendly.

    I do only know, you system with the upcoming events on your homepage is simply great!! I would love to "adopte" it.

    Thanks for listening.
    Best wishes from Switzerland
    Markus

  6. mcmartin
    Member
    Posted 8 years ago #

    Hi Markus,
    Sorry if I'm confused ... the modified php file I linked to had an extension of .txt ... you copied this to your plugins folder and then named it with .php extension right? Then what does the plugin manager show? Does it have the link to activate it? I think if it's not activated, it won't work at all.

    Like I tried to say, I haven't worked on making this a full-blown plugin, and perhaps there is some error I've made that's preventing it from being a 'real' plugin. Can you describe more what you mean when you say you can't activate it?
    -Mike

  7. sinus
    Member
    Posted 8 years ago #

    Hi Mike,
    Hey, I am very surprised to get so quick an answer, thank really for this.
    You are right:
    I putted your file as php in my plugin-folder.
    Then I went to the "plugin manager" in WordPress and there I saw the new entry like

    Plugin: Event calendar
    Version: 2.1
    Author: Alex Tingle
    and the description and finally the blue action for "Activate or not".

    Now I tried to activate, Result: nothing, means, the monitor flickers, but the word "Activate" (Aktivieren) is still there, means, I cannot activate this plugin. I have 3 other plugins (IImage Gallery, IImage Browser and Searchcomment), all other went fine and there is written "deactivate", what means, they are running.

    Well, the next step, I altered my sidebar.php in my Theme-folder (devenir en gris). The line

    <?php get_calendar(); ?>

    I replaced with

    <?php get_event_calendar(13); ?>

    where the 13 is the ID from my category for events.

    Now I tried to activate your plugin again, then my blog-site with the calender is messy and there is written into the blog-page this:
    ---------------
    Fatal error: Call to undefined function: get_event_calendar() in /home/sinus/public_html/blogxx/wp-content/themes/devenir_en_gris/sidebar.php on line 9
    ------------------

    This what happens. I have NOTHING changed in the stylesheet, because ... errr, to be honest, I do not know where. Maybe this is the fault?

    BTW: I use the newest wordpress 1.51. And as I said, after activating your plugin, it is not really activated, because the "plugin-line" is not "greenish" and the word "activate" stays there (instead of deactivate for a active-status).
    I am very sorry, if I made some bad thing and it would be great, if you can find after this description my error.

    I thought also, maybe your 6 tables with the monthes have not space on my blog, but I guess, this is not the real problem.

    THANKS in advance for think about my problem.
    Markus

  8. mcmartin
    Member
    Posted 8 years ago #

    Hi Markus,
    So it seems the problem is the plugin is not activating. Since I've never actually made a plugin, perhaps I've done something wrong. Or perhaps it doesn't like the changed filename (+MCM) or that filename doesn't match the name listed inside the plugin file. So try changing the filename of the plugin to eventcalendar2.php and then see if that will activate. Also, to show future events, you should also install the View Future Posts plugin as I linked to in the first message here.

    The call you make to get_calendar should still return just one month. So have multiple months, use a call something like what I do:
    <?php get_event_calendar(2,'sun',6,True,1); ?>
    This gets events for category 2, starting the week on Sunday, for 6 months, True shows all posts in this category, and 1 uses one letter day abbreviations. The changes I made to the plugin make it automatically go to a new table line after three months. So if you specify 3 or less months, they will all be side by side, then for 4-6 you'll get three on top and then the next up to three below, etc. I stopped checking after 15 months, so this will only work for that many months. As such, this output won't fit in the sidebar, which is why I put the call to generate the calenar in the main page for the specific category (category-2.php in my case).
    -Mike

  9. sinus
    Member
    Posted 8 years ago #

    Uh, hi, Mike,
    that all sounds good to me, I have now more info to try. Thanks for this, I will try it in some hours and of course give you a feedback.
    Best wishes
    Markus

  10. sinus
    Member
    Posted 8 years ago #

    Mike,
    only short, I have to go some hours ... :(

    I changed now ONLY the name to eventcalendar2.php and now I could activate the plugin. So this was for sure a good tip from you - heureka!
    The rest I will try an report later.
    Thanks
    Markus

  11. sinus
    Member
    Posted 8 years ago #

    Hi Mike,
    Sorry, I was busy. But now I made again a test:
    I did as you said.
    First I installed FuturePost (plugin).
    Then I installed your plugin.
    Both I could activate, that was new and great.

    Then I replaced my sidebar.php:
    The line

    <?php get_calendar(); ?>

    I replaced with

    <?php get_event_calendar(13); ?>

    Then my side created this error-message on the top:
    "WordPress database error: [You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ') GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 16' at ]
    SELECT DISTINCT * FROM wp_posts WHERE 1=1 AND 1) GROUP BY wp_posts.ID ORDER BY post_date DESC LIMIT 0, 16"

    Then I deactivated the Plugin "Future post" and the error disappeard, and the calendar seemed to be new, but I could not go to any day.

    I know, it must be boring for you, but with this news, do you mean, I have an old MySQL and cannot use your plugin? But the good news is, I saw the first time, that both plugins seemed to work somehow, because I could activate them, and I saw, that the design from the calendar changed. Hence your plugins seemed to work somehow, though not properly.

    Maybe, if you have still a hint or an idea for me, I would be thankful.
    Thanks in advance.
    Markus

  12. mcmartin
    Member
    Posted 8 years ago #

    Hmm ... whenever I've seen errors of that nature it was always something minor wrong in the PHP codes. Since it goes away when you disable Futureposts, let's see if there is something with that plugin. What do you have the two options in futurepost.php set to? I have mine
    $future_min_level=0;
    and
    $future_single_only=false;
    The first means everyone can see future posts, and the second means that future posts will show up in all the pages (category pages, date pages, as well as single post pages). Even with this set to false I still don't see future posts listed in the sidebar 'archives', so perhaps it's not as universal a setting as was intended, or perhaps the sidebar code isn't changed by the futureposts plugin.

    Anyway, after setting both of these variables in the futureposts plugin, see if you still get the error. If so, try putting the call to get_event_calendar in one of the other template pages (like the archives template, archive.php and see if it works there instead of the sidebar.

    -Mike

  13. sinus
    Member
    Posted 8 years ago #

    Hello Mike,
    Hey, cool! I make progress, with your help of course!

    1) Yes, I did the same options like you in "future posts", but definitively this plugin works not here on my computer, it shows allways the same MySQL-error like I posted before.

    2) Your plugin works!! Now I know, why the days worked not! I simply had used the entry <?php get_event_calendar(13,'mon',3,True,1); ?>
    but without having a real entry in the category with ID 13.
    When I entered one, then everything with your plugin works FINE except:

    a) When I have for example an entry for 26.06.2005, I can see this, when my cursor moves over the day in the calendar. But when I click on it, then the main page says "no entry for this date".

    I think, this is, because I cannot activate "Future post", is this correct?

    Then, finally, one single point about your whole system I understand not:
    It is your sentence "It uses a customized category-2.php".

    Where do you have this file, and what is in it and how it works?

    I used your monthes in my sidebar, and you are right, this does not fit.
    Hence I tried to call to get_event_calendar on my main page (index.php) and this worked great. At the top of the page three monthes were created.
    Super.

    I hope, if you could give me some infos about this "category_2.php", then I will do it in a manner, like you did on your fine site.

    Yes, and just now I went to your site, but at the moment your server or something is down, because I get some badly error on your site.
    I hope, you are online back soon and I hope, you have not a lot work with it ;)

    Thanks in advance, Mike, and again, your system is very, very close to that, what I a am looking for.
    Markus

  14. sinus
    Member
    Posted 8 years ago #

    Mike, I believe, that the SQL-error from the "Future post" could come from a problem with ". I have posted this, see here:
    http://www.figby.com/archives/2005/04/12/wordpress-15-plug-in-view-future-posts/

    I hope, there comes some help, let's look.
    So this seems to not your "fault".

    It would be nice, if you could give me, when you have time, an answer about the question 2 above (category-2.php).

    I see, your page works again, fine!
    I showed it to a friend, he was impressed, but he asked me one thing, what I could not answer:

    Is it possible, to use your system like a "normal calendar"? This means, he would prefer to see only one month (instead of 3 or six) and for going to the next month, there should be a button for the next/previous month.
    Is this possible, or my personal addional question, why you choosed your "design-solution" with 6 monthes visible?

    Thanks again
    Markus

  15. sinus
    Member
    Posted 8 years ago #

    Mike, hi,
    good news: now your plugin works as before and also the "Future post". I do not know, it it is correct, but I changed in Future post the line in actual:
    $content = preg_replace("/AND post_date_gmt <= .+/", 'AND 1', $content);

    and this works. All is no OK except this:

    I placed your line for call to get_event_calendar in the mainpage.
    Then for example I create a new post and set it to 26.06.2005.

    Everything works then, but this posting is then at the top of the main page, even a user posts a new post afterwards.

    Maybe with your "category-2.php" I could prevent this, I hope.
    You see, I think, to the final target it is now still only a short step.

    Now it is still to early to cry HEUREKA ;)
    best wishes
    Markus

  16. sinus
    Member
    Posted 8 years ago #

    Mike, hello,
    though there is the danger, that I do stress you, I give you this message here, what I posted to the Future Post - blog.
    MAYBE your (for me still not understandable) "category-2.php" could be a solution for this???
    Here the text:
    I think, this plugin is very good. But one BIG problem I can see. I do not know, is it not possible or do I understand something wrong.

    If I set the line
    $futuresingleonly�if set to true (default)

    then I can see NO post from the future. I can see the day in the calendar is red and this is fine, but if I click on it, I can not see the post. How I could see this by a permalink, sorry, I understand not.

    If I set the line to false, then everything is GREAT, BUT all the events in the future are in my page (index.php) at top, and this is not good in practice.

    Say, you define some birthdays and events in the future (some monthes ahead) and a user posts an actual post (theme, thread), then first all future events appears and the danger is big, that the actual post will not be seen.

    Did I undstood something wrong? How could I solve this?
    Thanks realy for hints.
    Markus

  17. mcmartin
    Member
    Posted 8 years ago #

    Hi Markus,
    Sorry for being out of touch for a few days. It sounds like you've figured out most things! Good job!

    Let me try to answer your questions:
    category-2.php this is a a file you can put in your themes folder to give the main page for category 2 a different type of look or code. So in your case, if you copy achive.php to category-13.php, then now whenver anyone requests the archive page for category 13, then they'll see whatever you've put into that new category-13.php code, instead of the default category archive look. This lets you set up just that page to have whatever calendar you like instead of putting it on the main page. Of course if you want to put the calendar on the main page, that's fine!

    Yes, the "future posts" plugin when you have $futuresingleonly set to false will show all future posts anywhere (calendar, the dates you click on, and the main home page). What I did was change the main home page so that each category is shown separately instead of just all posts by most recent date. You can customize the main page by copying index.php to main.php and then editing main.php to whatever you want. I've been using calls like <?php query_posts('category_name=news&showposts=3'); ?> to show only the most recent 3 'news', etc.

    Depending on what you'd like to do, you could also just make your main home page not show all posts from category 13:
    http://codex.wordpress.org/The_Loop#Exclude_Posts_From_Some_Category

    Or you could exclude only posts from the future on the main page even though the future posts plug-in would normally show them.

    <?php /* if this is a future post: */ if ($now <= get_the_time('U')) : ?>
    then_do_something
    <? php else: ?>
    show_the_post_or_whatever
    <? php endif; ?>

    As to why I did it for 6 months on my page, I figured that for upcoming conferences you really want to know a fair ways out what's coming up (usually you have to register for conferences several months in advance), so six months seemed reasonable since more would start pushing the page down too far to see it all easily.

    The other question you had was about how to make this like a 'normal' calendar with the next and previous month buttons at the top. Actually the plug-in will automatically put links to the next month that has a posting, and the previous month that has a posting. So if you fill up your calendar with enough entries, then I think this will work something like you're thinking.

    Hope that all helps! And glad to hear you're getting it to work! -Mike

  18. sinus
    Member
    Posted 8 years ago #

    Hi Mike,
    thanks a lot for your answer.
    At the same time Alex Tingle has also answered on
    http://www.figby.com/archives/2005/04/12/wordpress-15-plug-in-view-future-posts/

    and now he has made an update for his Eventcalendar2
    http://blog.firetree.net/2005/05/24/eventcalendar2/

    For now I tried this new plugin and ... everything seems to work as I wanted.
    This is great.

    What I will do, is, I will study and try your suggestions, but maybe some problems are gone with the new plugin.

    I will report it here, when I have news, again thanks, Mike, for your great work.
    Markus

  19. zarastudios
    Member
    Posted 8 years ago #

    Hi. I really like how you have modified the events calendar plugin. I've uploaded the new php file and everything works fine. My only question is, how did you get the events to be listed below the calendar? Nothing is displaying for me. Thanks.

  20. sinus
    Member
    Posted 8 years ago #

    Hi,
    Sorry, I did in the last time soooooooooooooo much and had success and not success, that I cannot more say, what I did and what not. This is bad, I know.

    But I changed the theme, because the previous "devenir en gris" gave me serious problems with Internet Explorer. Not with Firefox.

    Hence I dedided to change the template to "Jakarta". It is not that plain as the old one was, but very nice and a lot of technical stuff, what I like (for example the possibility to make the font bigger or smaller for the user).

    Then I took the new Plugin from Alex, as reported and everything is fine now for me.

    Below the calender I have managend (wow, I am proud, though I took only some codeline from devenir and pasted it into Jakarta's sidebar.php) to let display the last themes and last comments under the calendar.

    If you mean this, I can post here this code.
    See my new page at
    http://www.sinusbild.com/blogxx/

    Thanks for all the help, what I could get from here!
    Markus

  21. mcmartin
    Member
    Posted 8 years ago #

    zarastudios, the calendar plugin just generates the calendar and that's all. Glad to hear that much is working for you. To get the entries below, you can just leave The Loop executing as normal, or change it to get the entries below something like I did, only future entries first, and in chronological order instead of the last-entry-first as is the default for WP.

    This is the main part of the PHP code for what I did on my calendar page:


    <?php get_event_calendar(2,'sun',6,True,1); ?>

    <h2>Upcoming Events:</h2>
    <?php $now = gmdate('U'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php /* if this is a future post: */ if ($now <= get_the_time('U')) : ?>
    <div class="post">
    <h3 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h3>
    <small><?php the_time('l, F jS, Y') ?></small>

    <div class="entry">
    <?php the_excerpt() ?>
    </div>

    <?php trackback_rdf(); ?>

    </div>
    <?php endif; ?>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignright"><?php posts_nav_link('','','Next Entries »') ?></div>
    <div class="alignleft"><?php posts_nav_link('','« Previous Entries','') ?></div>
    </div>

    <h2 align="center">* * * *</h2>
    <h2>Past Events:</h2>

    <?php $now = gmdate('U'); ?>
    <?php rewind_posts(); ?>
    <?php while (have_posts()) : the_post(); ?>
    <?php /* if this is a past post: */ if ($now > get_the_time('U')) : ?>
    <div class="post">
    <h3 id="post-<?php the_ID(); ?>">" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></h3>
    <small><?php the_time('F jS, Y') ?></small>

    <?php trackback_rdf(); ?>

    </div>
    <?php endif; ?>
    <?php endwhile; ?>

    <div class="navigation">
    <div class="alignright"><?php posts_nav_link('','','Next Entries »') ?></div>
    <div class="alignleft"><?php posts_nav_link('','« Previous Entries','') ?></div>
    </div>

    So you see I run The Loop twice. The first time it only outputs future dates, and the second time it only outputs past dates. That way I can make the past dates show up in a more condensed format (no excerpt) to save space.

    I hope that helps some! -Mike

  22. zarastudios
    Member
    Posted 8 years ago #

    Thanks Mike. I copied to code you posted and the past events are displaying, but not the future events, even though they show up on the calendar. Any ideas?

  23. mcmartin
    Member
    Posted 8 years ago #

    Hmm ... are you using the FuturePosts plugin with $future_single_only=false; ? That should make all future posts available for showing.

Topic Closed

This topic has been closed to new replies.

About this Topic