Forums

[Plugin: Gigs Calendar] Sidebar (upcoming-widget.php) - display per tour? (8 posts)

  1. mkleywegt
    Member
    Posted 2 years ago #

    It seems from digging through the code in gigs-classes.php, that the tour information gets treated a little differently from the other

    My objective is simple: with multiple 'tours' going on, I would like the widget to display an x amount of gigs per tour (or even in total - as long as the tours are seperately listed).

    Another option would be to be able to discern tours in a single listing.

    Since I am not terribly good at PHP, I would appreciate any pointers!

  2. schwarzbox
    Member
    Posted 2 years ago #

    Per tour will not be as easy a with discerned tours.

    To do that, you have to add the following code to upcoming-widget.php (you might want to customize it to meet your expectations):

    <?php
       $t = new tour($g->tour_id);
    ?>
    <?php if ( !empty($t->name) ) : ?>
      <tr class="other">
        <td class="bold" valign="top">Tour: </td>
        <td><div class="notes"><?php echo nl2br($t->name); ?></div</td>
      </tr>
      <?php if ( !empty($t->notes) ) : ?>
        <tr class="other">
          <td class="bold" valign="top"> </td>
          <td>
            <div class="notes"><?php echo nl2br($t->notes); ?></div>
          </td>
        </tr>
      <?php endif; ?>
    <?php endif; ?>

    This will add two table rows. One with the name of the tour, the second with the notes of the tour (which you probably want to delete).

  3. mkleywegt
    Member
    Posted 2 years ago #

    Thank you for this solution! This has helped me tremendously.

    I have two additional questions, keeping in mind your contributions in the shortcodes-thread.

    The archive page that can be set from the settings-pane seems to employ the gigs-list.php template. At one point it broke, so I restored it manually with a shortcode ( [gig-cal archive template=gigs-list] ). This however ignores tour-information. How come? What does the setting-pane do differently?

    Also, for my particular need, I would like to have the option to display only one tour in a listing. Is there a work-around for that?

  4. schwarzbox
    Member
    Posted 2 years ago #

    You're welcome.

    Don't know about your problem with the broken archive you replaced. If I take a guess: Did you switch your template (or even deleted the custom template directory) maybe?

    Listing gigs of a certain tour only is easier than I thought it was:
    [gig-cal tour=REPLACE_WITH_TOUR_ID]

  5. mkleywegt
    Member
    Posted 2 years ago #

    Yes, got it to work. Beautiful.

    I am also trying to display these listings in the sidebar. I first tried the text-widget, but wp does not parse shortcodes from widgets (unless a hack is applied, which I could not get to work yet).

    Another idea would be to include the corresponding php resulting from the shortcode in sidebar.php. Is that a viable option in this case?

    Many thanks for you reply.

  6. schwarzbox
    Member
    Posted 2 years ago #

    C'mon, I helped you twice. But each time I answer, you come up with another question. Third time turns this thread into consultation request ;-)

    I've mentioned a possible way to solve your problem somewhere else in this forum. Just take a look around ..

  7. mkleywegt
    Member
    Posted 2 years ago #

    I hear you. To be fair, my first question already involved the widget-situation.

    At any rate, I have the solution at my fingertips, I just need to solve my other problem first. So thanks again.

    About that archive situation; I tried switching a few things around, but it remained quirky. I can't come up with a satisfactory explanation. But the shortcode can sufficiently reproduce the archive, as far as I am concerned.

  8. schwarzbox
    Member
    Posted 2 years ago #

    A solution I noted somewhere else were the PostLists-plugin in conjunction with the PostList-Extension Gigs Calendar:
    http://wordpress.org/extend/plugins/search.php?q=postlists

    As far as I can remember, it creates lists of results of customizable queries you an use in sidebars.

Topic Closed

This topic has been closed to new replies.

About this Topic