WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: All In One Event Calendar] How to add shortcode manually (18 posts)

  1. m.wiekenberg
    Member
    Posted 2 years ago #

    Hi everyone.

    If you ever wanted to have a shortcode like [ai1ec cat="15"] and waited really long release by release to get it. Here is the solution.

    Note:
    1. This changes the plug-in code. So backup your All-in-one-event-calender plug-in before starting.

    2. All changes will be away after updating to new version. Hopefully then there will be the shortcode by default :]

    Add Shortcode: Step-by-step:
    1. in /plugins/all-in-one-event-calendar/app/controller/class-ai1ec-app-controller.php at line 139:
    Add the following code for gatting called within posts. Shortcode will only work in postlist, not on site. I needed it this way. If nessessary comment please.
    add_filter( 'the_content', array( &$this, 'append_content' ), PHP_INT_MAX - 1 );

    2. in /plugins/all-in-one-event-calendar/app/controller/class-ai1ec-app-controller.php at line 408:
    Add additional function for shortcode without check of page id
    [Code moderated as per the Forum Rules. Please use the pastebin]

    3. in in /plugins/all-in-one-event-calendar/app/controller/class-ai1ec-app-controller.php at line 468-471:
    Replace code to add calender at the point where shortcode is positioned and not at the end.
    [Code moderated as per the Forum Rules. Please use the pastebin]

    4. in /plugins/all-in-one-event-calendar/app/controller/class-ai1ec-calender-controller.php at line 217:
    Add additional view function for shortcode:
    [Code moderated as per the Forum Rules. Please use the pastebin]

    5. Change your template Style.css:
    Add the styles for calender by adding following line to youre theme style.css (sorry did not found another solution)
    @import "../../plugins/all-in-one-event-calendar/css/calendar.css";

    6. optinal: in /plugins/all-in-one-event-calendar/app/view/calendar.php at line 41:
    Add a linebrake, so that callender fids into your page. Just try it out first ;)
    => change <td> to </tr><tr><td>

    7. Add shortcode
    => Add [ai1ec] in a post and it will work.
    => call a calender with a default category [ai1ec cat="15"] Will call calender with category 15. this is the category id. For multiple categories use [ai1ec cat="14,15"]
    => call a calender with a default tag [ai1ec tag="6"] Will call calender with tag 6. this is the tag id. For multiple tags use [ai1ec tag="6,7"]

    =>=> have fun! ;)

    No features:
    - use in sidebar
    - mutiple calender in a post => possible by decomment line 497 in app controller.php. search for //$content= $this->append_content( $content ); (but all callender will have same behavier due to singleton pattern in plugin. Just try it if you like to...

    I hope I could help you a bit. And please comment it, if something is not working on your side.

    @yani.iliev: Sorry for hacking your faboulos plugin. I needed this functionality ;)

    Greets
    Michael

    http://wordpress.org/extend/plugins/all-in-one-event-calendar/

  2. carletto0282
    Member
    Posted 2 years ago #

    Hi mate... I hope you have solve the tricky issue but can you please add the code in pastebin?

    We cannot see it!

    Thanks
    Bye

  3. m.wiekenberg
    Member
    Posted 2 years ago #

    Shure, sorry

    Step 2:
    http://pastebin.com/3VxafrES

    Step 3:
    http://pastebin.com/wwKnLdEW

    Step 4:
    http://pastebin.com/d40prtue

    Hope it helps you now ;)

  4. carletto0282
    Member
    Posted 2 years ago #

    Great man... I'll give it a try.

    Hope yani.iliev take a look on your work and give a feedback!

    Thanks anyway!
    Bye
    Carlo

  5. m.wiekenberg
    Member
    Posted 2 years ago #

    thanks carletto,

    please give me a comment if it works as fine for you then for me
    greets
    Mic

  6. Yani Iliev
    Member
    Posted 2 years ago #

    @m.wiekenberg
    Thank you for releasing this.
    I will take a look at the code and if possible I'll add it to the plugin.

  7. carletto0282
    Member
    Posted 2 years ago #

    Great news guys!

    Really great news!

    Hope for the best of it!

    Thank you everybody.

    I'll give you some feedback on it as soon as possible!
    Bye

  8. vokomonehe1
    Member
    Posted 2 years ago #

    Is this going to allow me to place the event in a sidebar?

    Also, my "class-ai1ec-app-controller.php" does not go up to line 468-471. Would it be possible for you to show all your code for that page?

  9. m.wiekenberg
    Member
    Posted 2 years ago #

    Hello vokomonehe1,

    currently the use in sidebar is not possible due to the point that ai1ec is using functions that are only working in a post loop. So only in pages and posts. Till now I did not spend additional effort to make this working. Sorry.
    Pherhaps anybody has a hint how to do this.

    Due to the step 3 and line 468-471:
    i was talking about the function append_content( $content ).
    Starting at if(in_the_loop()) and ending at </div>;

    My complete append function is here:
    http://pastebin.com/9hVCmKka

    Pherhaps copy past is easier ;)
    I think it was a bad idea to post line numbers due to changing plugin versions. sorry.

    Hope this is answering your question. Please let me know if it is working.

    Greets Michael

  10. vokomonehe1
    Member
    Posted 2 years ago #

    Thank's a lot Michael, Ill give this a shot.

  11. morga84
    Member
    Posted 2 years ago #

    It works beautifully! THANK YOU!

  12. m.wiekenberg
    Member
    Posted 2 years ago #

    You are very wellcome.
    Good to see that it works for others too.

  13. MikePayne
    Member
    Posted 2 years ago #

    For me, it's displaying the content of the calendar, but the styling is all messed up (yes, i imported the CSS file). And the cat parameter doesn't seem to work.

  14. MikePayne
    Member
    Posted 2 years ago #

    After further analysis, I've discovered the styles are importing, but the entire ai1ec-container is being wrapped in pre tags. . . curiouser and curiouser.

  15. martin_Jonh
    Member
    Posted 2 years ago #

    I need to have multiple calendar instances.
    Followed all shortcode steps mentioned, its giving me blank page after editing code,
    after debugging found that loop If(stripos($content, '[ai1ec')) is not executing, any idea, please help

  16. nelra
    Member
    Posted 2 years ago #

    Please check if you can find the answer here:
    multiple instances of the calendar

  17. martin_Jonh
    Member
    Posted 2 years ago #

    Thanks nelra, It works for me

  18. nelra
    Member
    Posted 2 years ago #

    Great to hear - thanks for the update

Topic Closed

This topic has been closed to new replies.

About this Topic