Jump to content


Photo
AnyLoop

Display custom meta from custom post types?



  • Please log in to reply
2 replies to this topic

#1 jasonkadlec

jasonkadlec

    Advanced Member

  • Members

  • 32 posts
  • Country: Country Flag

Posted 01 August 2013 - 11:53 PM

Nick:

 

Just bought your AnyLoop plugin  -- any way to get post meta to display in a loop?

 

Like, normally I'd use the following:

 

<?php echo get_post_meta($postid, 'dtf_merch_description', true);?>

 

I'm overhauling a site and it already has so much content stored in various meta fields like the one above.

 

Thoughts?  

 

Thanks!

 



#2 beardedavenger

beardedavenger

    Unicorn Wrangler

  • Members

  • 1219 posts
  • Country: Country Flag

Posted 02 August 2013 - 12:01 AM

I can put in a few hooks for you if you want. Just let me know where you wan them. .i., after content, after post, etc.



#3 jasonkadlec

jasonkadlec

    Advanced Member

  • Members

  • 32 posts
  • Country: Country Flag

Posted 02 August 2013 - 11:02 PM

I ended up having to code it the way I know how.... but I may still get the gig to do a full site overhaul for this client in which case I'd rebuild this page using DMS ( I got it all the way built except the bootstrap tabs and customizing the loop that runs down the right side of the page).

 

Please keep the page private... it's not live to the fans yet!! 

 

http://www.bandofhea...morning-record/

 

So, that right column is a custom post type -- the image isn't the thumbnail -- its a custom meta box, and the Buy Button that is showing is also a custom meta box.

 

The title across the top is the title... actually why not just paste the loop! Here is the loop -- (tried to clean this up.. in text mate it is sane, below the spacing got crazy...

 
<div class="span5 sidebar">
	<div class="row">
	  <div class="span5 header"><h3>Pre-order</h3></div>
	</div>
	<?php query_posts( array ( 'post_type' => 'store', 'cat' => '-5'));	
	if (have_posts()) : while (have_posts()) : the_post(); ?>
	<?php global $wp_query;$postid = $wp_query->post->ID ?>
		<div class="kicker"><!-- makes the bottom border and bottom padding-->
			<div class="row">
			 <div class="span5">
			   <h4><a href="<?php the_permalink();?>"><?php the_title();?></a></h4>
			 </div>	
			</div>	
			<div class="row">				
		        <div class="span5">
			  <div class="span1">
			    <a href="<?php the_permalink(); ?>"><img src="<?php echo get_post_meta($postid, 'dtf_merch_image', true); ?>"  alt ="<?php the_title(); ?>" /></a>
			</div>
			<div class="span3">
			 <?php echo get_post_meta($postid, 'dtf_merch_buyButton', true);?> <a href="<?php the_permalink(); ?>">More Info</a>
			</div>	
			</div>
			<div class="span4 excerpt"><?php the_content();?> 
                     </div>
		</div>
	</div>				
	<?php endwhile; endif; wp_reset_query(); ?>
	</div>
 </div>	
</div>

It would be wonderful to see how one would write some hooks to modify what comes out of the box & hopefully others could also benefit from the example of how to take that as the starting point and mess with it?

 

Or, instead of buying the plugin -- would it have been smarter to just create my own child theme, and then create my own section with the code above -- and just use that to build out the page?

 

 

 

Thank you thank you! 







Also tagged with one or more of these keywords: AnyLoop