Shortcodes: Display Classes on Your Site

The shortcodes correspond to the display type options that you set when adding a new class or editing an existing class. The options are the checkboxes: List, Detail, Detail1, Detail2, Detail3. You can select none, one or many of these options to decide which shortcodes you’d like to display that particular class. Detail1, Detail2, and Detail3 are sub-sets of the Detail shortcode display — any classes that are included in these three will also be included in the general Detail display.

List:
[classdex_list start="yyyy-mm-dd" stop="yyyy-mm-dd"]

Detail:
[classdex_detail start="yyyy-mm-dd" stop="yyyy-mm-dd" type="detail"]

Detail1:
[classdex_detail start="yyyy-mm-dd" stop="yyyy-mm-dd" type="detail1"]

Detail2:
[classdex_detail start="yyyy-mm-dd" stop="yyyy-mm-dd" type="detail2"]

Detail3:
[classdex_detail start="yyyy-mm-dd" stop="yyyy-mm-dd" type="detail3"]

For all of the shortcodes you have the option of using the word “today” instead of a specific start date. This enables the site to remove classes that have been completed by only showing classes between “today” and your stop date.

Advertisements

19 Responses to “Shortcodes: Display Classes on Your Site”

  1. ddapson2013 July 22, 2014 at 5:47 pm #

    How do I make it so that a weekend class doesn’t show up in the listing as “Saturdays, October 18-19…?”

    • howtononprofit July 24, 2014 at 5:13 pm #

      To remove the name of the day from the listing, you’ll need to edit shortcode.php in the ClassDex files. On lines 99-101 you’ll find:

      $content .= date(“l”, strtotime($row[‘start_date’]));
      if($recurring){ $content .= “s”; }
      $content .= “, “;

      Delete these three lines and you should be all set.

      Let me know if you have any issues.

  2. Jessica Smith Photography September 9, 2014 at 9:18 pm #

    Is there a way to display a subset of classes by account type? So I can have one page, with a different list for each “account type”?

    • howtononprofit September 9, 2014 at 9:32 pm #

      Unfortunately, “account” type is just meant for accounting purposes — this divides up the classes into the categories of your choice for the “Z-out” report which sums the total sales by these categories during a period of time.

      Use the “Shortcode display types” to choose which shortcodes the classes get sent to. This can be used to show a subset of your classes on a separate page, while another shortcode displays all of your classes on another page.

      Hope that helps!

      • Derek Switzer October 8, 2014 at 6:54 pm #

        I am trying to display a class on a page, I entered the shortcode to match the display type of the class (detail1) and it displays, but the “add to cart section is displaying as code… how can I fix that? :

        — [add_to_cart item=”1″ style=”padding:0px; display:inline;” showprice=”no” ] is displaying instead of buttons or whatever…

        Thanks for the help!

      • howtononprofit October 8, 2014 at 8:06 pm #

        Hi Derek,
        ClassDex works together with another plugin called Cart66 Lite. You must install that plugin before you create your classes in ClassDex. Installation instructions are here: https://howtononprofit.wordpress.com/classdex/installation/
        Best,
        John

  3. Kira Cleveland October 4, 2014 at 3:57 am #

    Can you get “List” to show classes based on when they are instead of their name?

    • howtononprofit October 8, 2014 at 8:01 pm #

      Hi Kira,
      Sure! To make the classes display by date, go to Dashboard >> Plugins >> Editor. Select the ClassDex plugin in the top menu and find the shortcodes.php file. On line 139 you’ll see:

      $query .= "ORDER BY title, start_date";

      Change this line to:

      $query .= "ORDER BY start_date";

      And save the file.

      That should do the trick! Let me know if you have any issues.

      Best,
      John

  4. matthew February 21, 2016 at 8:06 pm #

    hi,
    When i place a large amount of classes with many different dates, the dates are not in order, i have the 22nd before the 19th for example
    thanks
    matthew

    • howtononprofit February 22, 2016 at 8:57 pm #

      Hey Matthew,

      If you edit the plugin’s files, you’ll find a folder called “includes” and a file called “shortcodes.php”

      Line 139 reads: $query .= "ORDER BY title, start_date";

      Change that to: $query .= "ORDER BY start_date";

      Let me know if that works for you!

      Peace,
      John

      • matthew February 22, 2016 at 10:12 pm #

        ok s$%T has jut hit the fan i replaced as directed now i am getting this

        – Parse error: syntax error, unexpected ‘BY’ (T_STRING) in /home3/jenko/public_html/allagesfirstaidtraining.com/wp-content/plugins/classdex/includes/shortcodes.php on line 139

        and i can not even open my web page up ……. HHEEELLPPPP

      • howtononprofit February 22, 2016 at 10:49 pm #

        sorry you’re running into trouble! you’ll need to access the file by FTP, and revert to the original version of the file. you can download a clean version here: https://wordpress.org/plugins/classdex/

        my guess is that you copied and pasted the line — problem is that html quotes are often different than standard quotes and that is what most likely caused the problem. if you are able to put the original file back and you’d still like to make the change, instead of copy and paste, just delete the “title,”

        again sorry for the trouble and please let me know if i can be of assistance!

  5. matthew February 28, 2016 at 12:34 am #

    You are a legend thankyou i have made it work. I am not very savy on FTP, but was able to make it work. One more question then i will leave you alone hehe, How can i make the box bigger with all the information as it seems a little to scrunched together.
    thanks

    • matthew February 28, 2016 at 2:48 am #

      All sorted please disregard my last question i got it working again
      thanks again for a fantastic plugin

      • howtononprofit February 28, 2016 at 7:40 am #

        Cool, glad you able to get things working again!

  6. matthew February 28, 2016 at 2:53 am #

    Hi again,
    On my booking page i have all the information i need for my buyer to purchase my training course however i only have a limited amount of seats for the training session, meaning 10 spots, is it possible to have a count down on Classdex that states 10 spots available but when one seat is booked and paid the number goes down to 9 so my other buyers can see that the class is either fully booked with 0 on my web site or a number 9 meaning 9 positions are still available for that course.

    Thanks again

    Matthew

    • howtononprofit February 28, 2016 at 8:59 am #

      Hey Matthew,
      That’s a good idea! Are you using the shortcodes to build the class list? The classdex_list shortcode as before? If so, here’s the method:

      Line 155 has the information you need:


      elseif($row['max_size'] != 0 && $row['max_size'] <= number_of_students($row['class_id'])){ $class_status = "FULL"; }
      else { $class_status = "Open"; }

      $row['max_size'] is the maximum number of student.
      number_of_students($row['class_id']) is the total number currently enrolled.
      So spots left is the difference.

      So from this info, you can build a new variable: $spots_left

      Initialize the variable by adding a line to line 153:

      $spots_left = 0;

      Now we’ll set it. Line 156 reads:

      else { $class_status = "Open"; }

      Change that to:

      else { 
        $class_status = "Open"; 
        if($row['max_size'] != 0) {
          $spots_left = $row['max_size'] - number_of_students($row['class_id']);
        }
      }
      

      This means that when the max size is not set to zero (the condition for an unlimited class size), then we’ll define this new variable.

      Now we need to add that variable to our output.

      Line 168 reads:

      $content .= "<td>[add_to_cart item=\"" . $row['class_id'] . "\" showprice=\"no\" ]</td>";

      Change that to:

        if( $spots_left == 0 ) {
          $content .= "<td>[add_to_cart item=\"" . $row['class_id'] . "\" showprice=\"no\" ]</td>";
        } else {
          $content .= "<td>[add_to_cart item=\"" . $row['class_id'] . "\" showprice=\"no\" ]<br>" . $spots_left . " spots left</td>";
        }
      

      Hope that works for you!

      Peace,
      John

  7. Matthew Jenkins June 23, 2016 at 12:32 am #

    hi i am little confused with the Short Codes. I need to have 3 Different class lists for 3 different courses advertised on the one Web page. is this possible?

    • howtononprofit June 24, 2016 at 4:22 pm #

      Hey Matthew,

      Not exactly sure what you’re asking. All of the classes of the “detail_1” type are displayed in the “detail_1” list. If you want classes of one type grouped together, mark them as “detail_1” and display with the detail_1 shortcode. Same for detail_2 and 3.

      Best,
      John

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: