WordPress.org

Forums

Event List
[resolved] How to include Event List in own template? (12 posts)

  1. ChrisPrefect
    Member
    Posted 1 year ago #

    OK I saw that very short information in FAQ on how to insert the event list in your own template, but there is no sample on how to include the file properly.

    I have some problems to get it included. How do I get the path to the sc_events-list.php file? It doesn't even work hard coded for me (damn windows server I guess).

    plugin_basename(__FILE__) gives me: D:/www/www11/site/wp-content/themes/toxic/index.php. Does that help?

    plugin_dir_path(__FILE__) gives me: D:\www\www11\site\wp-content\themes\toxic/

    How do I include the sc_event-list.php properly? (It has to be possible to move the wordpress installation for going live from "/site/" to "/" )

    Should this work?:

    <?php
    $dir = "/site/wp-content/plugins/event-list/includes/sc_event-list.php";
    require_once( $dir );
    $EventList = SC_Event_List::get_instance();
    echo $EventList->show_html("event-list num_events=3 show_filterbar=false link_to_event=false");
    ?>

    Also, this produces no output:

    <?php echo do_shortcode( "[event-list num_events=3 show_filterbar=false link_to_event=false]" ) ?>

    Thank you!
    Chris

    http://wordpress.org/plugins/event-list/

  2. mibuthu
    Member
    Plugin Author

    Posted 1 year ago #

    I do not know alot about themes but in my opinion if the plugin is enabled an inclusion of the file should not be necessary. The shortcode should be registered automatically.

    Probably ou can try this to check if the shortcode is available.

    If you want to include via the function directly your code is almost o.k. but you have to give the attributes as an array:

    <?php
    $dir = "/site/wp-content/plugins/event-list/includes/sc_event-list.php";
    require_once( $dir );
    $EventList = SC_Event_List::get_instance();
    $atts = array(num_events => 3, show_filterbar => false, link_to_event => false);
    echo $EventList->show_html($atts);
    ?>
  3. afreyer
    Member
    Posted 10 months ago #

    any news about using templates for this plugin? i am looking for a way to use my own template too.

    thanx.

  4. ChrisPrefect
    Member
    Posted 10 months ago #

    I used this code which seems to work:

    <?php
    require_once( $EVENTS_PLUGIN_PATH );
    $EventList = SC_Event_List::get_instance();
    $atts = array("num_events"=>2, "show_filterbar"=>false, "link_to_event"=>false, "show_starttime"=>false, "show_location"=>false, "show_details"=>false);
    echo $EventList->show_html($atts);
    ?>

    With

    $EVENTS_PLUGIN_PATH = "D:\\www\\www11\\site\\wp-content\\plugins\\event-list\\includes\\sc_event-list.php";
  5. afreyer
    Member
    Posted 10 months ago #

    thank you for your answer. ok, i can change parameters with your code. but how can i change the output and style with a template?

  6. ChrisPrefect
    Member
    Posted 10 months ago #

    With CSS

  7. afreyer
    Member
    Posted 10 months ago #

    and the order of these elements?

  8. ChrisPrefect
    Member
    Posted 10 months ago #

  9. mibuthu
    Member
    Plugin Author

    Posted 10 months ago #

    There is no possibility to change the order of the event elements at the moment. It is planned to provide an option to do this but it isn't included yet.
    You have to modify the code if you want to reorder the elements already now.

  10. afreyer
    Member
    Posted 10 months ago #

    is it possible to loop all events as a post_type parameter? so i could make my own shortcode.

  11. mibuthu
    Member
    Plugin Author

    Posted 10 months ago #

    No it isn't. But you can get the events data directly from the database or you can call the get_events function in includes/db.php.
    As a basis for your shortcode you can take the code in includes/sc_event-list.php.
    You can also modify the code in that file (especially the "html_event" function).

  12. afreyer
    Member
    Posted 10 months ago #

    now, i use another plugin. i look forward to new version of event list.

    thank you.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Event List
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic