Support » Fixing WordPress » Future events category & anotated calendar working!

  • mcmartin

    (@mcmartin)


    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

Viewing 15 replies - 1 through 15 (of 22 total)
  • sinus

    (@sinus)

    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

    DianeV

    (@dianev)

    That is really nice, Mike. Nice implementation.

    mcmartin

    (@mcmartin)

    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.

    sinus

    (@sinus)

    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

    mcmartin

    (@mcmartin)

    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

    sinus

    (@sinus)

    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

    mcmartin

    (@mcmartin)

    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

    sinus

    (@sinus)

    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

    sinus

    (@sinus)

    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

    sinus

    (@sinus)

    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

    mcmartin

    (@mcmartin)

    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

    sinus

    (@sinus)

    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

    sinus

    (@sinus)

    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

    sinus

    (@sinus)

    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

    sinus

    (@sinus)

    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

Viewing 15 replies - 1 through 15 (of 22 total)
  • The topic ‘Future events category & anotated calendar working!’ is closed to new replies.