Menu icon Foundation
Reveal-Modal for Custom Post Type

I have a custom post type for Portfolios; currently I am displaying this using Clearing Lightbox; however I think using Reveal-Modal would be a better approach. Problem is; how to set up the reveal-modal for each individual post! As I understand reveal-modal needs an ID for display and I need help where a single ID will display for each new custom post. The code is bellow which is set up for Clearing Lightbox. Any thoughts how this can be modified for a reveal-modal? Thanks

<?php query_posts( 'post_type=portfolios'); ?>
    <ul class="small-block-grid-1 large-block-grid-2 medium-block-grid-2 clearing-thumbs" data-clearing id="<?php echo $select_page;?>">
	
	<?php while (have_posts()) : the_post();

		$thumb_src = null;
	if ( has_post_thumbnail($post->ID) ) {
		$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'our-portfolio' );
		$thumb_src = $src[0];
	}
	?>

	<?php if ( $thumb_src ): ?>
		
		<li style="margin: 0;clear:none;"><a href=""><img src="<?php echo $thumb_src; ?>" alt="<?php the_title(); ?>" class="th radius" style="width: 100%;" data-caption="<?php the_title();?>"> <h5 style="font-weight:normal;text-align:center;"><cite class="subheader"><a href="<?php echo get_post_meta( get_the_ID(), 'portfolio_url', true); ?>"><?php echo get_post_meta( get_the_ID(), 'client_name', true); ?></h5></a>
			<p style="padding-top:10px;"><h4 class="subheader">Description</h4><?php echo get_post_meta( get_the_ID(), 'portfolio_description', true); ?></p>
	<?php endif; ?>
		
	<?php endwhile;?></a></li></cite>
</ul>
            

         

revealmodal

I have a custom post type for Portfolios; currently I am displaying this using Clearing Lightbox; however I think using Reveal-Modal would be a better approach. Problem is; how to set up the reveal-modal for each individual post! As I understand reveal-modal needs an ID for display and I need help where a single ID will display for each new custom post. The code is bellow which is set up for Clearing Lightbox. Any thoughts how this can be modified for a reveal-modal? Thanks

<?php query_posts( 'post_type=portfolios'); ?>
    <ul class="small-block-grid-1 large-block-grid-2 medium-block-grid-2 clearing-thumbs" data-clearing id="<?php echo $select_page;?>">
	
	<?php while (have_posts()) : the_post();

		$thumb_src = null;
	if ( has_post_thumbnail($post->ID) ) {
		$src = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'our-portfolio' );
		$thumb_src = $src[0];
	}
	?>

	<?php if ( $thumb_src ): ?>
		
		<li style="margin: 0;clear:none;"><a href=""><img src="<?php echo $thumb_src; ?>" alt="<?php the_title(); ?>" class="th radius" style="width: 100%;" data-caption="<?php the_title();?>"> <h5 style="font-weight:normal;text-align:center;"><cite class="subheader"><a href="<?php echo get_post_meta( get_the_ID(), 'portfolio_url', true); ?>"><?php echo get_post_meta( get_the_ID(), 'client_name', true); ?></h5></a>
			<p style="padding-top:10px;"><h4 class="subheader">Description</h4><?php echo get_post_meta( get_the_ID(), 'portfolio_description', true); ?></p>
	<?php endif; ?>
		
	<?php endwhile;?></a></li></cite>
</ul>
            

         
Marven 9 days ago

You can easily create a WordPress custom post type for any theme by navigating to function.php file from your theme directory and then add the code into it that I mentioned below.

/* Custom Post Type Start */

function create_posttype() {
register_post_type( 'news',
// CPT Options

array(
  'labels' => array(
   'name' => __( 'news' ),
   'singular_name' => __( 'News' )
  ),
  'public' => true,
  'has_archive' => false,
  'rewrite' => array('slug' => 'news'),
 )
);
}
// Hooking up our function to theme setup
add_action( 'init', 'create_posttype' );

/* Custom Post Type End */