Exemple #1
0
function cptr_category_selector()
{
    global $post_ID;
    $cptr_post_types = _cptr_get_post_types();
    ?>
	
	<div id='cat-selector'>
		<select id='howmany' name='howmany'>
			<option value='10'>10</option>
			<option value='50'>50</option>
			<option value='100'>100</option>
			<option value='-1'>All</option>
		</select> posts from 

		<select id='posttype' name='cptr_post_type'>
	 	<?php 
    foreach ($cptr_post_types as $key => $type) {
        ?>
			<option value="<?php 
        echo $key;
        ?>
">
				<?php 
        echo $type->labels->name;
        ?>
			</option>
		<?php 
    }
    ?>
		</select>
		
		ordered by 
		<select id='orderby' name='orderby'>
			<option value='title'>Title</option>
			<option value='date'>Date</option>
		</select>
		 in 
		<select id='orderin' name='orderin'>
			<option value='ASC'>Ascending</option>
			<option value='DESC'>Descending</option>
		</select> order &nbsp;
		&nbsp; Filter: <input type='text' id='filtered' name='filtered' />
		<input type='hidden' id='h_pid' name='h_pid' value='<?php 
    echo $post_ID;
    ?>
'/>
		<input type='button' class='cptr_button button' value='Search' />
	</div>
	
	<div class="postbox">
		<h3>Available Posts</h3>
		<div id="available-posts">Please select a category</div>
		<h3>Related Posts (Drag to reorder)</h3>
		<div id="related-posts">
			<?php 
    $relations = get_post_meta($post_ID, CI_CPTR_POST_RELATED, true);
    if (!empty($relations)) {
        foreach ($relations as $relation) {
            $post = get_post($relation);
            echo "<div title='" . $post->post_title . "' class='thepost' id='post-" . $post->ID . "'>\n\t\t\t\t\t\t\t<a href='#' class='removeme'>Remove</a>\n\t\t\t\t\t\t\t<p><strong>" . $post->post_title . "</strong></p>\n\t\t\t\t\t\t\t<input type='hidden' name='reladded[]' value='" . $post->ID . "' />\n\t\t\t\t\t\t\t</div>";
        }
    }
    ?>
			
			<input type="hidden" name="myplugin_noncename" id="myplugin_noncename" value="<?php 
    echo wp_create_nonce(plugin_basename(__FILE__));
    ?>
" />
		</div>
	</div>

	<?php 
}
Exemple #2
0
function _cpr_get_post_types()
{
    _cptr_deprecated_function(__FUNCTION__, '2.2', '_cptr_get_post_types');
    return _cptr_get_post_types();
}