public
Last active

simple-spec.php file with custom post type defined

  • Download Gist
full-spec.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13
<?php
 
$full_mb = new WPAlchemy_MetaBox(array
(
'id' => '_full_meta',
'title' => 'Full Inputs',
'types' => array('movies'), // added only for pages and to custom post type "events"
'context' => 'normal', // same as above, defaults to "normal"
'priority' => 'high', // same as above, defaults to "high"
'template' => get_stylesheet_directory() . '/metaboxes/full-meta.php'
));
 
/* eof */
page-testmovie.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
<?php
/**
* Template Name: Test Page Template
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site will use a
* different template.
*
* @package WordPress
* @subpackage Twenty_Eleven
* @since Twenty Eleven 1.0
*/
 
get_header(); ?>
 
<!-- begin colLeft -->
<!--<div id="colLeft">-->
 
<h1><?php the_title(); ?></h1>
 
<!-- LOOP THE CONTENT ALPHABETICALLY -->
<?php
$loop = new WP_Query(array(
'post_type' => 'movies',
'orderby' => 'name',
'order' => 'ASC', ));
?>
<?php while ( $loop->have_posts() ) : $loop->the_post(); ?>
<?php
// instead of using helper functions, you can also use ...
$meta = get_post_meta(get_the_ID(), $full_mb->get_the_id(), TRUE);
// or ... (same as above)
// $meta = $custom_metabox->the_meta();
 
echo '<p><strong>TITLE:</strong>'.$meta['name'].'<br />';
echo '<strong>DESCRIPTION:</strong>'.$meta['description'].'</p>';
 
echo '<p><strong>REPEATING DOCUMENT TITLE:</strong>'.$meta['title'].'<br />';
echo '<strong>REPEATING DOCUMENT LINK:</strong>'.$meta['link'].'</p>';
 
?>
<?php the_content(); ?>
<?php endwhile; ?> <!--</div>-->
<!-- end colleft -->
 
<?php get_footer(); ?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.