WordPress.org

Ready to get started?Download WordPress

Forums

Showtime
Shortcode for a particular day only (14 posts)

  1. djbedo
    Member
    Posted 1 year ago #

    Hi. Is there a shortcode or a way to create one that will display Monday only or Tuesday only something like [showtime-monday] ??

    thanks!

    http://wordpress.org/extend/plugins/showtime/

  2. phoros
    Member
    Posted 1 year ago #

    I'm playing with this plugin and gonna use it on my radio site soon. I've modified it a little and added few lines of code, mostly connected with proper utf-8/translations behaviours php<->mysql. I've also added a function (and a proper shortcode) for displaying a schedule for a current day (today). It's not a tough thing to create several functions and shortcodes for any/each day actually. If anyone is interested - I'll explain it here. I'm not a programmer and my solutions might occur a blasphemy for true coders but... they work. :) Here's the proof.

  3. BrowCo
    Member
    Posted 1 year ago #

    phoros - Love that idea! Please let us know how you did it. I am interested in the php template code to insert it directly within my design.

  4. phoros
    Member
    Posted 1 year ago #

    Ok, here's the trick.

    In showtime.php file in line #153 there's a beginning of "showtime_schedule_handler" function. It ends in line #190. Right below there's the shortcode for it:
    add_shortcode('showtime-schedule', 'showtime_schedule_handler');

    I've copied the whole function, changed it name for "showtime_schedule_taday" (in my national language ;), added a variable
    $today = date('l');
    added the the condition
    if ($day == $today)
    and changed
    $output .= '<h2>'.$day.'</h2>';
    for
    $output .= '<h2>'.$today.'</h2>';

    So the whole code looks like this:

    function showtime_schedule_today($atts, $content=null, $code=""){
    
    	global $wpdb;
    	global $showtimeTable;
    
    	//Get the current schedule, divided into days
    	$daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    
            $today = date('l');
    
    	$schedule = array();
    
    	$output = '';
    
    	foreach ($daysOfTheWeek as $day) {
    		//Add this day's shows HTML to the $output array
    		$showsForThisDay =  $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $showtimeTable WHERE dayOfTheWeek = '$day' ORDER BY startTime" ));
    
            if ($day == $today) {
    
    		//Check to make sure this day has shows before saving the header
    		if ($showsForThisDay){
    			$output .= '<h2>'.$today.'</h2>';
    			$output .= '<ul class="showtime-schedule">';
    			foreach ($showsForThisDay as $show){
    				$showName = $show->showName;
    				$startClock = $show->startClock;
    				$endClock = $show->endClock;
    				$linkURL = $show->linkURL;
    				if ($linkURL){
    					$showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
    				}
    
    				$output .= '
    <li><strong>'.$startClock.'</strong> - <strong>'.$endClock.'</strong>: '.$showName.'</li>
    ';
    
    			}
    			$output .= '';
    		}
                }
    	}
    	return $output;
    }

    After this I've added below a new shortcode [showtime-today]:
    add_shortcode('showtime-today', 'showtime_schedule_today');
    and voila. It works. :)

    The same way should also work for a particular day (haven't tested):

    $monday = ('Monday');
    if ($day == $monday)

    and so on.

    My code is much more modificated with two more translating functions but this is the main idea and it seems to work fine. As I've mentioned I know almost nothing about php so if someone can polish and optimize it - please do.

    I'm glad if could help.
    Cheers from Poland!

  5. BrowCo
    Member
    Posted 1 year ago #

    Thanks so much for this!

    By the way, are you running the latest version of WP? I've recently upgraded to the latest version and am now getting errors from the plugin. :(

  6. phoros
    Member
    Posted 1 year ago #

    As I said here I've frozen WP and stuck with 3.1.3 in my main website. It's too big (nearly 100GB of data) and too important to take any risks of touching the core and/or heavily modified plugins. I tried once - it ended up with few days of restoring... So if this plugin indeed doesn't work with newer versions I can only recommend switching back for older ones OR call The Developer to sort it out.

  7. ReginaldTerrell
    Member
    Posted 1 year ago #

    Phoros did you erase the original code or just added another short code

  8. phoros
    Member
    Posted 1 year ago #

    I've added few lines. Below is my whole file showtime.php. I use the plugin to display schedules for today & tomorrow ("dzisiaj" & "jutro" in Polish) and for displaying "Now on air" on page and in the custom widget. Here's the working page which is actually a mix of few plugins. "Showtime" is used at the top (now on air) and i first two tabs (for today and for tomorrow).

    <?php
    setlocale(LC_ALL, array('pl_PL.UTF-8','pl_PL@euro','pl_PL','polish'));
    /*
    Plugin Name: Showtime
    Plugin URI: http://www.outtolunchproductions.com/showtime
    Description: Allows you to create, manage and display a programming schedule. Optional display of the next upcoming show. Insert into templates with <?php if (function_exists('showme_showtime')) echo showme_showtime(); ?> and into posts/pages with the [showtime-schedule] shortcode.
    Author: Carter Fort
    Version: 3.0
    Author URI: http://www.outtolunchproductions.com
    */
    if (!defined('ABSPATH')) {
    	exit("Sorry, you are not allowed to access this page directly.");
    }
    
    /* Set constant for plugin directory */
    define( 'SS3_URL', WP_PLUGIN_URL.'/showtime' );
    
    $showtime_db_version = "3.0";
    $showtimeTable = $wpdb->prefix . "WPShowtime";
    
    $tz = get_option('timezone_string');
    date_default_timezone_set($tz);
    
    //Installation
    
    function showtime_install () {
       global $wpdb;
       global $showtime_db_version;
       global $showtimeTable;
    
       $showtimeTable = $wpdb->prefix . "WPShowtime";
    
       if($wpdb->get_var("show tables like '$showtimeTable'") != $showtimeTable) {
    
          $sql = "CREATE TABLE " . $showtimeTable . " (
    	  id int(9) NOT NULL AUTO_INCREMENT,
    	  dayOfTheWeek text NOT NULL,
    	  startTime int(11) NOT NULL,
    	  endTime int(11) NOT NULL,
    	  startClock text not null,
    	  endClock text not null,
    	  showName text NOT NULL,
    	  linkURL text NOT null,
    	  imageURL text not null,
    	  UNIQUE KEY id (id)
    	);";
    
          require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
          dbDelta($sql);
    
          add_option("showtime_db_version", $showtime_db_version);
    
       }
    
    }
    
    register_activation_hook(__FILE__,'showtime_install');
    
    //Queue up jQuery
    
    function showtime_jQuery_method() {
        wp_deregister_script( 'jquery' );
        wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js');
        wp_enqueue_script( 'jquery' );
    }    
    
    add_action('wp_enqueue_scripts', 'showtime_jQuery_method');
    
    //Register and create the Widget
    
    class ShowTimeWidget extends WP_Widget
    {
     /**
      * Declares the ShowTimeWidget class.
      *
      */
        function ShowTimeWidget(){
        $widget_ops = array('classname' => 'widget_showtime', 'description' => __( "Display your schedule with style.") );
        $control_ops = array('width' => 300, 'height' => 300);
        $this->WP_Widget('ShowTime', __('Showtime'), $widget_ops, $control_ops);
        }
    
      /**
        * Displays the Widget
        *
        */
        function widget($args, $instance){
          extract($args);
          $title = apply_filters('widget_title', empty($instance['title']) ? '&nbsp;' : $instance['title']);
    
          # Before the widget
          echo $before_widget;
    
          # The title
          if ( $title )
          echo $before_title . $title . $after_title;
    
          # Make the Showtime widget
          echo '<div class="showtime-now-playing"></div>';
    
          # After the widget
          echo $after_widget;
      }
    
      /**
        * Saves the widgets settings.
        *
        */
        function update($new_instance, $old_instance){
          $instance = $old_instance;
          $instance['title'] = strip_tags(stripslashes($new_instance['title']));
          $instance['lineOne'] = strip_tags(stripslashes($new_instance['lineOne']));
          $instance['lineTwo'] = strip_tags(stripslashes($new_instance['lineTwo']));
    
        return $instance;
      }
    
      /**
        * Creates the edit form for the widget.
        *
        */
        function form($instance){
          //Defaults
          $instance = wp_parse_args( (array) $instance, array('title'=>'Now Playing') );
    
          $title = htmlspecialchars($instance['title']);
    
          # Output the options
          echo '<p style="text-align:right;"><label for="' . $this->get_field_name('title') . '">' . __('Title:') . ' <input style="width: 250px;" id="' . $this->get_field_id('title') . '" name="' . $this->get_field_name('title') . '" type="text" value="' . $title . '" /></label></p>';
            }
    
    }
    
      function ShowTimeInit() {
      register_widget('ShowTimeWidget');
      }
      add_action('widgets_init', 'ShowTimeInit'); 
    
    //==== OPTIONS ====
    
    add_option('showtime_upcoming', 'yes');
    add_option('showtime_use_images', 'yes');
    add_option('showtime_shutitdown', 'no');
    add_option('off_air_message', 'We are currently off the air.');
    add_option('showtime_css', '');
    add_option('showtime_shutitdown', 'no');
    
    //==== SHORTCODES ====
    
    // *********** POLSKIE NAZWY MIESIĘCY ************
    
    function localStrftime($format, $timestamp = 0)
            {
                    if($timestamp == 0)
                    {
                            // Sytuacja, gdy czas nie jest podany - używamy aktualnego.
                            $timestamp = time();
                    }
    
                    // Nowy kod - %F dla odmienionej nazwy miesiąca
                    if(strpos($format, '%F') !== false)
                    {
                            $mies = date('m', $timestamp);
    
                            // odmienianie
                            switch($mies)
                            {
                                    case 1:
                                            $mies = 'stycznia';
                                            break;
                                    case 2:
                                            $mies = 'lutego';
                                            break;
                                    case 3:
                                            $mies = 'marca';
                                            break;
                                    case 4:
                                            $mies = 'kwietnia';
                                            break;
                                    case 5:
                                            $mies = 'maja';
                                            break;
                                    case 6:
                                            $mies = 'czerwca';
                                            break;
                                    case 7:
                                            $mies = 'lipca';
                                            break;
                                    case 8:
                                            $mies = 'sierpnia';
                                            break;
                                    case 9:
                                            $mies = 'września';
                                            break;
                                    case 10:
                                            $mies = 'października';
                                            break;
                                    case 11:
                                            $mies = 'listopada';
                                            break;
                                    case 12:
                                            $mies = 'grudnia';
                                            break;
                            }
                            // dodawanie formatowania
                            return strftime(str_replace('%F', $mies, $format), $timestamp);
                    }
                    return strftime($format, $timestamp);
            } // end localStrftime();
    
    //************* PROGRAM NA DZIŚ ************************				
    
    function showtime_schedule_dzisiaj($atts, $content=null, $code=""){
    
    	global $wpdb;
    	global $showtimeTable;
    
    	//Get the current schedule, divided into days
    	$daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    
    			$konwersja['Monday'] = 'poniedziałek';
         $konwersja['Tuesday'] = 'wtorek';
         $konwersja['Wednesday'] = 'środa';
         $konwersja['Thursday'] = 'czwartek';
         $konwersja['Friday'] = 'piątek';
         $konwersja['Saturday'] = 'sobota';
         $konwersja['Sunday'] = 'niedziela';
    		 $dzisiaj = date('l');
    		 $dzisiaj_full = localStrftime('%e %F %Y');
    
    	$schedule = array();
    
    	$output = '';
    
    	foreach ($daysOfTheWeek as $day) {
    		//Add this day's shows HTML to the $output array
    		$showsForThisDay =  $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $showtimeTable WHERE dayOfTheWeek = '$day' ORDER BY startTime" ));
    
    		if ($day == $dzisiaj) {
    
    		//Check to make sure this day has shows before saving the header
    		if ($showsForThisDay){
    			$output .= '<div style="color:#54480D;font-size:19px;font-weight:bold;margin:10px 0 0 30px">'.$konwersja[$day].'</div>';
    			$output .= '<div style="font-size:12px;margin:0 0 20px 30px">'.$dzisiaj_full.'</div>';
    			$output .= '<ul class="showtime-schedule">';
    
    			foreach ($showsForThisDay as $show){
    				$showName = $show->showName;
    				$startClock = $show->startClock;
    				$endClock = $show->endClock;
    				$linkURL = $show->linkURL;
    
    				if ($linkURL){
    					$showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
    				}
    
    				$output .= '<li><strong>'.$startClock.'</strong> - '.$showName.'</li>';
    
    			}
    
    			$output .= '</ul>';
    		}
    		}
    	}
    	return $output;
    
    }
    
    //************* PROGRAM NA JUTRO ************************				
    
    function showtime_schedule_jutro($atts, $content=null, $code=""){
    
    	global $wpdb;
    	global $showtimeTable;
    
    	//Get the current schedule, divided into days
    	$daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    
    			$konwersja['Monday'] = 'poniedziałek';
         $konwersja['Tuesday'] = 'wtorek';
         $konwersja['Wednesday'] = 'środa';
         $konwersja['Thursday'] = 'czwartek';
         $konwersja['Friday'] = 'piątek';
         $konwersja['Saturday'] = 'sobota';
         $konwersja['Sunday'] = 'niedziela';
    		 $jutro = date("l", strtotime("tomorrow"));
    		 $jutro_full = localStrftime("%e %F %Y", strtotime("tomorrow"));
    
    	$schedule = array();
    
    	$output = '';
    
    	foreach ($daysOfTheWeek as $day) {
    		//Add this day's shows HTML to the $output array
    		$showsForThisDay =  $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $showtimeTable WHERE dayOfTheWeek = '$day' ORDER BY startTime" ));
    
    		if ($day == $jutro) {
    
    		//Check to make sure this day has shows before saving the header
    		if ($showsForThisDay){
    			$output .= '<div style="color:#54480D;font-size:19px;font-weight:bold;margin:10px 0 0 30px">'.$konwersja[$day].'</div>';
    			$output .= '<div style="font-size:12px;margin:0 0 20px 30px">'.$jutro_full.'</div>';
    			$output .= '<ul class="showtime-schedule">';
    
    			foreach ($showsForThisDay as $show){
    				$showName = $show->showName;
    				$startClock = $show->startClock;
    				$endClock = $show->endClock;
    				$linkURL = $show->linkURL;
    
    				if ($linkURL){
    					$showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
    				}
    
    				$output .= '<li><strong>'.$startClock.'</strong> - '.$showName.'</li>';
    
    			}
    
    			$output .= '</ul>';
    		}
    		}
    	}
    	return $output;
    
    }
    
    //*********** PROGRAM NA TYDZIEŃ *******************
    
    function showtime_schedule_handler($atts, $content=null, $code=""){
    
    	global $wpdb;
    	global $showtimeTable;
    
    	//Get the current schedule, divided into days
    	$daysOfTheWeek = array("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
    
    			$konwersja['Monday'] = 'poniedziałek';
         $konwersja['Tuesday'] = 'wtorek';
         $konwersja['Wednesday'] = 'środa';
         $konwersja['Thursday'] = 'czwartek';
         $konwersja['Friday'] = 'piątek';
         $konwersja['Saturday'] = 'sobota';
         $konwersja['Sunday'] = 'niedziela';
    
    	$schedule = array();
    
    	$output = '';
    
    	foreach ($daysOfTheWeek as $day) {
    		//Add this day's shows HTML to the $output array
    		$showsForThisDay =  $wpdb->get_results( $wpdb->prepare ( "SELECT * FROM $showtimeTable WHERE dayOfTheWeek = '$day' ORDER BY startTime" ));
    
    		//Check to make sure this day has shows before saving the header
    		if ($showsForThisDay){
    			$output .= '<div style="color:#54480D;font-size:19px;font-weight:bold;margin:10px 0 20px 30px">'.$konwersja[$day].'</div>';
    			$output .= '<ul class="showtime-schedule">';
    
    			foreach ($showsForThisDay as $show){
    				$showName = $show->showName;
    				$startClock = $show->startClock;
    				$endClock = $show->endClock;
    				$linkURL = $show->linkURL;
    
    				if ($linkURL){
    					$showName = '<a href="'.$linkURL.'">'.$showName.'</a>';
    				}
    
    				$output .= '<li><strong>'.$startClock.'</strong> - '.$showName.'</li>';
    
    			}
    
    			$output .= '</ul>';
    		}
    	}
    	return $output;
    
    }
    
    //********** SHORTCODY *************
    
    add_shortcode('showtime-schedule', 'showtime_schedule_handler');
    
    add_shortcode('showtime-dzisiaj', 'showtime_schedule_dzisiaj');
    
    add_shortcode('showtime-jutro', 'showtime_schedule_jutro');
    
    function showme_showtime(){
    
    		return '<div class="showtime-now-playing"></div>';
    
    }
    
    add_shortcode('showtime-now-playing', 'showme_showtime');
    
    if ( is_admin() ){ // admin actions
    	add_action('admin_menu', 'showtime_plugin_menu');
    }
    
    function showtime_image_upload_scripts() {
    wp_enqueue_script('media-upload');
    wp_enqueue_script('thickbox');
    wp_enqueue_script('my-upload');
    }
    
    function showtime_image_upload_styles() {
    wp_enqueue_style('thickbox');
    }
    
    if (isset($_GET['page']) && $_GET['page'] == 'showtime_settings') {
    add_action('admin_print_scripts', 'showtime_image_upload_scripts');
    add_action('admin_print_styles', 'showtime_image_upload_styles');
    }
    
    //==== ADMIN OPTIONS AND SCHEDULE PAGE ====
    
    function showtime_plugin_menu() {
        // Add a new submenu under Options:
        add_menu_page('Program RF', 'Program RF', 5, 'showtime_settings', 'showtime_options_page', 0);
    
    }
    
    function admin_register_head() {
        $siteurl = get_option('siteurl');
        $url = SS3_URL . '/admin.css';
        echo "<link rel='stylesheet' type='text/css' href='$url' />\n";
    }
    add_action('admin_head', 'admin_register_head');
    
    function showtime_options_page(){
    
    	global $wpdb;
    	global $showtimeTable;
    	//Check to see if the user is upgrading from an old Showtime database
    
    	if (isset($_POST['upgrade-database'])){
    		if (check_admin_referer('upgrade_showtime_database', 'upgrade_showtime_database_field')){
    
    			if ($wpdb->get_var("show tables like '$showtimeTable'") != $showtimeTable){
    				$sql = "CREATE TABLE " . $showtimeTable . " (
    					  id int(9) NOT NULL AUTO_INCREMENT,
    					  dayOfTheWeek text NOT NULL,
    					  startTime int(11) NOT NULL,
    					  endTime int(11) NOT NULL,
    					  startClock text not null,
    					  endClock text not null,
    					  showName text NOT NULL,
    					  linkURL text NOT null,
    					  imageURL text not null,
    					  UNIQUE KEY id (id)
    					);";
    
    				      $wpdb->query($sql);
    			}
    
    			$showtimeOldTable = $wpdb->prefix.'showtime';
    
    			$oldShowtimeShows = $wpdb->get_results($wpdb->prepare("SELECT id, showstart, showend, showname, linkUrl, imageUrl FROM $showtimeOldTable"));
    			if ($oldShowtimeShows){
    				foreach ($oldShowtimeShows as $show){
    					$showname = $show->showname;
    					$startTime = $show->showstart;
    					$endTime = $show->showend;
    					$startDay = date('l', $startTime);
    					$startClock = strftime('%H:%M', ($startTime));
    					$endClock = strftime('%M:%M', ($endTime));
    					$linkURL = $show->linkUrl;
    					if ($linkURL == 'No link specified.'){
    						$linkURL = '';
    					}
    					$imageURL = $show->imageUrl;
    
    					//Insert the new show into the New Showtime Databse
    					$wpdb->query( $wpdb->prepare("INSERT INTO $showtimeTable (dayOfTheWeek, startTime,endTime,startClock, endClock, showName,  imageURL, linkURL) VALUES (%s, %d, %d , %s, %s, %s, %s, %s)", $startDay, $startTime, $endTime, $startClock, $endClock, $showname, $imageURL, $linkURL )	);
    				}
    			}
    		}
    		//Remove the old Showtime table if the new table has been created
    		if($wpdb->get_var("show tables like '$showtimeTable'") == $showtimeTable) {
    			$wpdb->query("DROP TABLE $showtimeOldTable");
    		}
    	}
    
    	echo '<script type="text/javascript" src="'.SS3_URL.'/admin.js" ></script>';
    
    ?>
    	<div class="wrap">
    		<div class="showtime-message-window">Message goes here.</div>
    		<h2>Program Radia FARA</h2>
    		<p><small>Czas wpisujemy w formacie 24-godzinnym. <a href="options-general.php">Strefa czasowa</a> musi być ustawiona na miasto.<br/>
    				             	<em>Twoja strefa czasowa to: <?php if (get_option('timezone_string') == '') { echo '<strong style="color:red;">Set your <a href="options-general.php">timezone</a> city now.</strong></em></small></p>'; } else { echo get_option('timezone_string'); ?></em></small></p>
    
    		<?php
    			//Check to see if Showtime 2.0 is installed
    		 	$table_name = $wpdb->prefix . "showtime";
    		   if($wpdb->get_var("show tables like '$table_name'") == $table_name) {
    		   	?>
    		   		<div class="error">
    		   			<form method="post" action="">
    		   				<p><strong>Previous version of Showtime detected.</strong> Be sure to back up your database before performing this upgrade. <input type="submit" class="button-primary" value="Upgrade my Showtime Database" /></p>
    		   				<input type="hidden" name="upgrade-database" value=' ' />
    						<?php wp_nonce_field('upgrade_showtime_database', 'upgrade_showtime_database_field'); ?>
    		   			</form>
    		   		</div>
    		   	<?php
    		   }
    
    		?>
    
    		<input type="hidden" class="script-src" readonly="readonly" value="<?= $_SERVER['PHP_SELF']; ?>?page=showtime_settings" />
    		<?php wp_nonce_field('delete_showtime_entry', 'delete_entries_nonce_field'); ?>
    
    		<ul class="tab-navigation">
    			<li class="showtime-scheudle">Program</li>
    			<li class="showtime-options">Opcje</li>
    			<li class="shut-it-down" style="border:none;">Off</li>
    		</ul>
    		<div class="showtime-tabs">
    
    			<div class="tab-container" id="showtime-schedule">
    
    				<h3>Dodaj</h3>
    
    				<div class="add-new-entry">
    
    					<form id="add-showtime-entry" method="post" action="<?= SS3_URL ?>/crud.php">
    						<div class="set-showtime-show-deets">
    				            <div class="show-time-container">
    					            <big><strong>Początek</strong></big><br />
    					           <label for="start">
    						           	<select class="startDay" name="sday">
    						          	 	<option value="Sunday">niedziela</option>
    						            	<option value="Monday">poniedziałek</option>
    						            	<option value="Tuesday">wtorek</option>
    						            	<option value="Wednesday">środa</option>
    						            	<option value="Thursday">czwartek</option>
    						            	<option value="Friday">piątek</option>
    						            	<option value="Saturday">sobota</option>
    						            </select>
    					        	</label> 
    
    					            <label for="starttime">
    					            <input id="starttime" class="text" name="startTime" size="5" maxlength="5" type="text" value="00:00" /></label>
    				            </div>
    				            <div class="show-time-container">
    					            <big><strong>Koniec</strong></big><br />
    					           	<label for="endday">
    						           	<select class="endDay" name="eday">
    						           		<option value="Sunday">niedziela</option>
    						            	<option value="Monday">poniedziałek</option>
    						            	<option value="Tuesday">wtorek</option>
    						            	<option value="Wednesday">środa</option>
    						            	<option value="Thursday">czwartek</option>
    						            	<option value="Friday">piątek</option>
    						            	<option value="Saturday">sobota</option>
    						            </select>
    						        </label> 
    
    					            <label for="endtime">
    					            <input id="endtime" class="text" name="endTime" size="5" maxlength="5" type="text" value="00:00" /></label>
    				             </div>
    				             <div class="clr"></div>
    
    				            <p>Nazwa: <br/>
    				           		<input id="showname" type="text" name="showname" class="show-detail" />
    							</p>
    
    				            <p>Link URL (opcjonalnie):<br />
    								<label for="linkUrl">
    
    								<input type="text" name="linkUrl" placeholder="Nie ustawiono linku." class="show-detail" />
    
    							</p>
    
    				            <input type="submit" class="button-primary" style="cursor: pointer;" value="Dodaj" />
    				            <input type="hidden" name="crud-action" value="create" />
    				            <?php wp_nonce_field('add_showtime_entry', 'showtime_nonce_field'); ?>
    
    				            <?php } ?>
    
    				        </div>
    				    </form>
    
    				<div class="clr"></div>
    
    				</div>
    
    				<p>wersja: <a href="#" class="display-toggle full-display">pełna</a> | <a href="#" class="display-toggle simple-display">uproszczona</a></p>
    
    				<form method="post" action="<?= SS3_URL ?>/crud.php" class="showtime-update-shows">
    					<div class="showtime-schedule loading">
    						<div class="sunday-container"><h2>niedziela</h2></div><!-- end this day of the week -->
    						<div class="monday-container"><h2>poniedziałek</h2></div><!-- end this day of the week -->
    						<div class="tuesday-container"><h2>wtorek</h2></div><!-- end this day of the week -->
    						<div class="wednesday-container"><h2>środa</h2></div><!-- end this day of the week -->
    						<div class="thursday-container"><h2>czwartek</h2></div><!-- end this day of the week -->
    						<div class="friday-container"><h2>piątek</h2></div><!-- end this day of the week -->
    						<div class="saturday-container"><h2>sobota</h2></div><!-- end this day of the week -->
    					</div>
    				<input type="hidden" name="crud-action" value="update" />
    
    				<?php wp_nonce_field('save_showtime_entries', 'showtime_entries_nonce_field'); ?>
    
    				</form>
    
    				<p>wersja: <a href="#" class="display-toggle full-display">pełna</a> | <a href="#" class="display-toggle simple-display">uproszczona</a></p>
    
    			</div>
    
    			<div class="tab-container" id="showtime-options">
    			<form method="post" action="">
    				<h2>Options</h2>
    				<?php
    
    				//Save posted options
    
    				if (isset($_POST['showtime_options'])){
    
    					update_option('showtime_upcoming', $_POST['showtime_options']['showUpcoming']);
    					update_option('showtime_use_images', $_POST['showtime_options']['imagesOn']);
    					update_option('off_air_message', htmlspecialchars(stripslashes($_POST['showtime_options']['offAirMessage'])));
    					update_option('showtime_css', htmlspecialchars(stripslashes($_POST['showtime_options']['showtimeCSS'])));
    
    				} else if (isset($_POST['shut-it-down'])) {
    					update_option('showtime_shutitdown', $_POST['shut-it-down']);
    				}
    
    				//Set options variables
    				$showUpcoming = get_option('showtime_upcoming');
    				$imagesOn = get_option('showtime_use_images');
    				$shutItDown = get_option('showtime_shutitdown');
    				$offAirMessage = get_option('off_air_message');
    				$showtimeCSS = get_option('showtime_css');
    				$shutItDown = get_option('showtime_shutitdown');
    
    				?>
    
    				<h3>Display Images</h3>
    					<form id="option" method="post" action="">
    					<p>Show accompanying images with showtimes?</p>
    						<label><input type="radio"<?php if($imagesOn == 'yes') { ?> checked="checked"<?php } ?> name="showtime_options[imagesOn]" value="yes" /> : Yes</label><br/>
    						<label><input type="radio"<?php if($imagesOn == 'no') { ?> checked="checked"<?php } ?> name="showtime_options[imagesOn]" value="no" /> : No</label><br/>
    
    					<h3>Upcoming Timeslot</h3>
    
    					<p>Show the name/time of the next timeslot?</p>
    						<label><input type="radio"<?php if($showUpcoming == 'yes') { ?> checked="checked"<?php } ?> name="showtime_options[showUpcoming]" value="yes" /> : Yes</label><br/>
    						<label><input type="radio"<?php if($showUpcoming == 'no') { ?> checked="checked"<?php } ?> name="showtime_options[showUpcoming]" value="no" /> : No</label><br/>
    
    					<h3>Off-air Message</h3>
    						<label>Off-air message:<br /><input type="text" id="off-air-message" value="<?= $offAirMessage; ?>" name="showtime_options[offAirMessage]" size="40" /></label>
    
    				    <p class="submit">
    						<input type="submit" class="button-primary" value="Update Options" />
    					</p>
    
    		    <h2>Display Shortcodes</h2>
    			<h3>[showtime-schedule]</h3>
    				<p>Display a list of the times and names of your events, broken down into days of the week, like so:</p>
    				<div style="margin-left:30px;">
    				<h4>Thursday</h4>
    					<ul>
    						<li><strong>5:00 am - 10:00 am</strong> - Thursdie Moarning</li>
    						<li><strong>10:00 am - 12:00 pm</strong> - Afternoons with Freddie</li>
    					</ul>
    					<h4>Friday</h4>
    					<ul>
    						<li><strong>7:00 am - 9:00 am</strong> - Drive Time</li>
    						<li><strong>2:00 pm - 4:00 pm</strong> - Celebrity Immolations</li>
    					</ul>
    				</div>
    			<h3>[showtime-now-playing]</h3>
    				<p>Display the Now Playing widget.</p>
    
    		   	<div class="clr"></div>
    			<h2>CSS</h2>
    
    		    <textarea name="showtime_options[showtimeCSS]" cols="90" rows="30"><?= $showtimeCSS ?></textarea>    
    
    		    <p class="submit">
    		    <input type="submit" class="button-primary" value="Update Options" />
    		    </p>
    		    </form>
    
    			</div>
    
    			<div class="tab-container" id="showtime-shut-it-down">
    
    				<h2>Shut it Down</h2>
    
    				<form method="post" action="">
    					<p>You can temporarily take your schedule down in case of holidays, illnesses, thermo-nuclear war, etc.</p>
    				    	<label><input type="radio"<?php if($shutItDown == 'yes') { ?> checked="checked"<?php } ?> name="shut-it-down" value="yes" /> : Yes, shut it down.</label><br/>
    						<label><input type="radio"<?php if($shutItDown == 'no') { ?> checked="checked"<?php } ?> name="shut-it-down" value="no" /> : No, we're back to regularly scheduled programming. </label><br/>
    
    				    <p class="submit">
    				    	<input type="submit" class="button-primary" value="Save it" />
    					</p>
    			 	</form>
    
    			</div>
    
    		</div><!-- end the showtime tabs -->
    
    	</div>
    
    <?
    
    }
    
    function showtime_header_scripts(){
    
    	echo '<script>crudScriptURL = "'.SS3_URL.'/crud.php"</script>';
    	echo '<script type="text/javascript" src="'.SS3_URL.'/showtime.js" ></script>';
    
    }
    
    add_action("wp_head","showtime_header_scripts");
    
    ?>
  9. ReginaldTerrell
    Member
    Posted 1 year ago #

    Phoros how do we remove the "Scheduling Conflict" so that we are able to have listings that are at the same time

  10. phoros
    Member
    Posted 1 year ago #

    I don't think it's possible with this code. Its mechanism is as simple as comparing scheduled times saved in db with 'now' and displaying the results in different ways. I suppose such option is possible only with more complicated calendars/agendas/etc.

  11. ericjenkins
    Member
    Posted 1 year ago #

    Here is an english version of phoros' code

    [Excessive code moderated. Please use a pastebin.]

    I am working on trying to show the schedule for any given day of the week. IE [showtime-monday]

  12. ericjenkins
    Member
    Posted 1 year ago #

    Showing just one day of the week is actually quite simple. Add these lines to your showtime.php page right before the shortcode section.

    [Again - Excessive code moderated. Please use a pastebin.]

    then add
    add_shortcode('showtime-monday', 'showtime_schedule_monday');
    to the Shortcode section. Repeat this step changing each "monday" with the day of the week you will call for.
    All I did was change the strtotime() to "Monday" then changed each "tomorrow" variable to "Monday.

  13. Maris2
    Member
    Posted 1 year ago #

    Hi Eric and Phoros, thank you for all the information you are sharing.
    Please give me some advice as to where I've gone wrong with the coding (my experience with coding is zero). I would like to break down the showtime into days of the week (such as what Phoros has on his site). When I copied the code above into my .php it gave me the following error message:
    Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/musicbym/public_html/edencountry.co.za/wp-content/plugins/showtime/showtime.php on line 161

    I replaced it with the original coding that I backed up.

    I would like to break the schedule up into days of the week, and have it show up like Phoros has it on his site (in table form, with the schedule appearing underneath when you click on the day).

    I will really appreciate your help.

  14. Maris2
    Member
    Posted 1 year ago #

    Yay!!!! I figured it out! If anyone is looking for the complete coding with all the days of the week included here it is.
    This is the entire code, so you can just replace, no need to look for lines etc. The days of the week can be displayed with the following shortcode on your page: [showtime-monday] OR [showtime-tuesday] etc. I hope you find it helpful!

    [That's WAAAY too much code to post here - use a pastebin if you want to post that much - see: http://codex.wordpress.org/Forum_Welcome#Posting_Code

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.