Jump to content
Sign in to follow this  
sustainableweb

Custom post type filename

Recommended Posts

sustainableweb

Hi, I created a custom post type called gddprogram, in functions.php of the EcoPro theme. I also created a file gddprogram-single.php in the theme's main directory. When I browse to this url: http://dev.greendegreedirectory.com/?gddprogram=b-s-degree-in-custom-post-types-for-green-organizations It appears as if this single post template is not getting loaded. What is the best way of loading it? Thanks, Ivan

Share this post


Link to post
Share on other sites
bryan-hadaway

Unfortunately, this one will have to wait until the morning for the developers. You'll need to bump your topic to make it visible to them. Thanks, Bryan

Share this post


Link to post
Share on other sites
sustainableweb

Bump (on suggestion of moderator)

Share this post


Link to post
Share on other sites
cmunns

You may have to explicitly add a conditional for this custom post type to the loop ( check in theloop.php , appropriately named :) ) I'm thinking this one is the one you'll need to change `<?php if(pl_show_content($post->ID)): // Post and Page Content ?>` but it would help if i knew what you placed in your custom files as well.

Share this post


Link to post
Share on other sites
sustainableweb

Thanks Adam. Going through that file in MacGDBp (debugger on localhost) helps. I'm hesitant to post client code here without their permission. Can I email you?

<?php if(function_that_figures_out_the_custom_post_type() == "gddprogram"): ?>

I'm thinking the if would go before / replace line 56 to 73 of _theloop.php ? Do I put the content there (what's one more if clause, no problem!) or would it be better include my gddprogram-single.php ? Sorry for being somewhat new to WordPress API, and not having used PHP in a while, I spend most of my time in ruby. Thanks, Ivan

Share this post


Link to post
Share on other sites
sustainableweb

here's my solution: in _theloop.php :

<?php  if(get_post_type($post->ID) == 'gddprogram'):  // is a GDD Program ?>
	  <?php get_template_part('_gddprogram'); ?>
	<?php elseif(pl_show_content($post->ID)): // Post and Page Content ?>
	

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×