Example #1
0
function movie_schedule_content($post)
{
    wp_nonce_field(basename(__FILE__), 'movie_schedule_nonce');
    $post_id = $post->ID;
    $meta = get_post_meta($post_id);
    // Custom editor settings
    $editor_options = array('media_buttons' => false, 'wpautop' => false, 'textarea_rows' => 6, 'quicktags' => false, 'tinymce' => array('toolbar1' => 'bold,italic,strikethrough,link,unlink', 'toolbar2' => '', 'toolbar3' => '', 'toolbar4' => ''));
    // Determine start date
    if (isset($meta['start_date'][0]) && $meta['start_date'][0] != '') {
        $meta['start_date'][0] = date('M. j, Y', $meta['start_date'][0]);
    } else {
        $meta['start_date'][0] = date('M. j, Y', strtotime('next Friday'));
    }
    // Determine end date
    if (isset($meta['end_date'][0]) && $meta['end_date'][0] != '') {
        $meta['end_date'][0] = date('M. j, Y', $meta['end_date'][0]);
    } else {
        $meta['end_date'][0] = date('M. j, Y', strtotime('next Friday +6 days'));
    }
    ?>

	<h3>Active Period</h3>
	<p>Please enter the first and last date this movie will show on. You can use any date format you want, just remember to include the day, month and year.</p>
	<p>
		<label>Start Date: <input type="text" name="start_date" value="<?php 
    echo $meta['start_date'][0];
    ?>
" placeholder="e.g. <?php 
    echo date('M. j, Y', strtotime('next Friday'));
    ?>
"/></label>
		<label>End Date: <input type="text" name="end_date" value="<?php 
    echo $meta['end_date'][0];
    ?>
" placeholder="e.g. <?php 
    echo date('M. j, Y', strtotime('next Friday +6 days'));
    ?>
"/></label>
	</p>

	<h3>Special Listing</h3>
	<p>Selecting one of the following options will remove the listing from the Now Playing and Coming Soon pages.</p>
	<p class="radio-group">
		<label>Label: <input type="text" name="listing_label" value="<?php 
    echo echo_var($meta['listing_label'][0]);
    ?>
" placeholder="e.g. Special Showtime"/></label>
		<label><input type="radio" name="listing_type" value="none" <?php 
    checked(echo_var($meta['listing_type'][0], 'none'), 'none');
    ?>
>None</label>
		<label><input type="radio" name="listing_type" value="popup" <?php 
    checked(echo_var($meta['listing_type'][0]), 'popup');
    ?>
>Show as Popup</label>
		<label><input type="radio" name="listing_type" value="widget" <?php 
    checked(echo_var($meta['listing_type'][0]), 'widget');
    ?>
>Show in Widget</label>
	</p>

	<h3>Showtimes</h3>
	<p>Enter your showtimes here. Basic formatting is allowed (bold, italic, links, etc.)</p>
	<p><?php 
    wp_editor(htmlspecialchars_decode(echo_var($meta['showtimes'][0])), 'showtimes', $editor_options);
    ?>
</p>

	<h3>Notes</h3>
	<p>Notes are added to the bottom of the showtimes box in larger font and a contrasting background colour to grab attention.</p>
	<p><?php 
    wp_editor(htmlspecialchars_decode(echo_var($meta['notes'][0])), 'notes', $editor_options);
    ?>
</p>

	<input type="hidden" id="post_id" value="<?php 
    echo $post->ID;
    ?>
">
	<input type="hidden" name="fetched" value="0">

<?php 
}
Example #2
0
function movie_details_content($post)
{
    wp_nonce_field(basename(__FILE__), 'movie_details_nonce');
    $post_id = $post->ID;
    $meta = get_post_meta($post_id);
    $ratings_directory = get_stylesheet_directory_uri() . '/assets/images/ratings';
    ?>

	<h3>Run time</h3>
	<p><input type="number" name="runtime_minutes" value="<?php 
    echo echo_var($meta['runtime_minutes'][0]);
    ?>
" /> minutes</p>

	<h3>Rating</h3>
	<p>
		<label>
			<input type="radio" name="rating" value="G" <?php 
    echo echo_checkbox($meta['rating'][0], 'G');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/g.png" class="rating-icon" title="G">
		</label>
		<label>
			<input type="radio" name="rating" value="PG" <?php 
    echo echo_checkbox($meta['rating'][0], 'PG');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/pg.png" class="rating-icon" title="PG">
		</label>
		<label>
			<input type="radio" name="rating" value="14A" <?php 
    echo echo_checkbox($meta['rating'][0], '14A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/14a.png" class="rating-icon" title="14A">
		</label>
		<label>
			<input type="radio" name="rating" value="18A" <?php 
    echo echo_checkbox($meta['rating'][0], '18A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/18a.png" class="rating-icon" title="18A">
		</label>
		<label>
			<input type="radio" name="rating" value="R" <?php 
    echo echo_checkbox($meta['rating'][0], 'R');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/r.png" class="rating-icon" title="R">
		</label>
		<label>
			<input type="radio" name="rating" value="A" <?php 
    echo echo_checkbox($meta['rating'][0], 'A');
    ?>
>
			<img src="<?php 
    echo $ratings_directory;
    ?>
/a.png" class="rating-icon" title="A">
		</label>
		<?php 
    if (isset($meta['json_response'])) {
        ?>
			<a class="button" id="rating-confirm">Confirm Film Rating</a><span id="rating-spinner" class="spinner"></span>
			<div id="rating-response" class="">
				<p>
					<span></span>
					<a href="http://www.consumerprotectionbc.ca/consumers-film-and-video-homepage/classification-search?submitted=1&featuretitle=<?php 
        echo urlencode(preg_replace("/[^a-zA-Z0-9\\s]+/", "", get_the_title()));
        ?>
" target="_blank">Open website to confirm</a>
				</p>
			</div>
		<?php 
    }
    ?>
	</p>

	<h3>Cast</h3>
	<p><textarea name="starring" rows="5" placeholder="Starring..."><?php 
    echo echo_var($meta['starring'][0]);
    ?>
</textarea></p>

	<h3>Description</h3>
	<p><textarea name="description" rows="5" placeholder="Description..."><?php 
    echo echo_var($meta['description'][0]);
    ?>
</textarea></p>
	<input type="hidden" name="genres">

<?php 
}