Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme »

Custom Post Templates Revisited


  #1  
Old Jan 30, 2010, 03:06 PM
waded1
 
5 posts · Nov 2009
Washington, USA
Custom Post Templates Revisited

I have read through may threads on how to create Custom Post Templates while using the Atahualpa Theme. I am about 95% there. Here is a little background:

I am using a copy of index.php, renamed it to post-template.php. I added at the begining of the file.
Code:
<?php  /* creates a Post Template */
/*
Template Name Posts: Post-Template
*/
?>

I made all of the changes I wanted. I added them below:
Code:
<?php /* This is the actual Wordpress LOOP. 

		The output can be edited at Atahualpa Theme Options -> Style & edit the Center column */

		bfa_center_content($bfa_ata['content_inside_loop']); ?>
I am using the Custom Post Template Plugin so I can choose the custom post template within the post.

All of this works. The issue I am running into is when I use this custom post template, the information is added below the Information bar (bar that contains the Date, Category, Edit Post). I have tried moving my content to different areas within my post-template.php file. With no luck.

If it helps, here is a copy of my post-template.php

Code:
<?php  /* creates a Post Template */
/*
Template Name Posts: Custom-Post
*/
?>



<?php 	/* get all options: */

include (TEMPLATEPATH . '/functions/bfa_get_options.php');

get_header(); ?>



<?php /* If there are any posts: */

if (have_posts()) : $bfa_ata['postcount'] == 0; /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>



	<?php /* This outputs the next/previous post or page navigation. 

	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */

	bfa_center_content($bfa_ata['content_above_loop']); ?>



	<?php /* The LOOP starts here. Do this for all posts: */

	while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>

	

		<?php /* Add Odd or Even post class so post containers can get alternating CSS style (optional) */

		$odd_or_even = (($bfa_ata['postcount'] % 2) ? 'odd-post' : 'even-post' ); ?> 



		<?php /* This is the actual Wordpress LOOP. 

		The output can be edited at Atahualpa Theme Options -> Style & edit the Center column */

		bfa_center_content($bfa_ata['content_inside_loop']); ?>



<?php echo c2c_get_post_custom(559,"post-top"); ?>

<table align="left" style="width: 800px">
<tbody>
<tr style="height: 25px;">
<td style="text-align: center; height: 300px;" colspan="6" align="center" valign="top"><?php echo do_shortcode('[starratingmulti id=4 tpl=12]'); ?>

<strong>Write your own review of <?php echo c2c_get_custom(name); ?> at the bottom of this page.</strong></td>
<td style="text-align: right;" colspan="3" align="right"><?php echo c2c_get_post_custom(559,"ad-square"); ?></td>
</tr>
</tbody>
</table>

<?php echo c2c_get_post_custom(559,"post-middle"); ?>

<h1><?php echo c2c_get_custom(name); ?> Details</h1>
<?php echo c2c_get_custom(details); ?>

<h3>Recreation near <?php echo c2c_get_custom(name); ?></h3>
<?php echo c2c_get_custom(recreation); ?>

<h3>Directions to <?php echo c2c_get_custom(name); ?></h3>
<?php echo c2c_get_custom(directions); ?>

<h3>Photo Gallery</h3>
<?php echo do_shortcode('[showtime]'); ?>

<h4>Additional Information</h4>
<?php echo c2c_get_post_custom(559,"ad-footer"); ?>
<?php echo c2c_get_post_custom(559,"post-bottom"); ?>

<h4>Write your own review of <?php echo c2c_get_custom(name); ?> below:</h4>


						

	<?php /* END of the LOOP */

	endwhile; ?>



	<?php /* This outputs the next/previous post or page navigation and the comment template.

	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */

	bfa_center_content($bfa_ata['content_below_loop']); ?>



<?php /* END of: If there are any posts */

else : /* If there are no posts: */ ?>



<?php /* This outputs the "Not Found" content, if neither posts, pages nor attachments are available for the requested page.

This can be edited at Atahualpa Theme Options -> Style & edit the Center column */

bfa_center_content($bfa_ata['content_not_found']); ?>



<?php endif; /* END of: If there are no posts */ ?>



<?php bfa_center_content($bfa_ata['center_content_bottom']); ?>



<?php get_footer(); ?>
Thank you in advance for any assistance.
  #2  
Old Apr 24, 2010, 06:07 AM
Douglas
 
15 posts · Apr 2010
I'd love it if Paulae could respond to this question, as it relates to her previous answer (http://forum.bytesforall.com/showthread.php?t=6057).

I am trying to set up some custom post templates, too. But the Index.php file in version 3.4.6 doesn't seem to have as much content in the loop (compared to Paulae's example). The new version has a single block for "This is the actual WordPress loop" instead of the individually listed components "bfa kicker, headline, etc."

This may be waded1's problem -- that he/she can't find a way to insert custom code between the individual components of the page because they're not individually listed.

What are we missing?
  #3  
Old Apr 24, 2010, 07:27 AM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
Ah. You know what? When I switched from Atahualapa 3.4.5 to 3.4.6, I just copied my custom post templates right into the folder and didn't change them at all. So right now, they are based on the old index.php, not the new one! They work just fine, but I'm glad you brought this to my attention. I've fixed one of them. I'm pasting it in, and you'll see the code I added in red. I want the custom part to show up at the end of the post, before the comments box.

Of course, you can do much the same thing by creating a new widget area and putting it where you want it in the center column theme options area.

I think if you want to put custom content in a more precise area, there might be a layout plugin for that.

Code:
<?php
/*
Single Post Template: my-newcareerdoctor-template
Description: This part is optional, but helpful for describing the Post Template
*/
?>
<?php 	/* get all options: */
include (TEMPLATEPATH . '/functions/bfa_get_options.php');
get_header(); ?>

<?php /* If there are any posts: */
if (have_posts()) : $bfa_ata['postcount'] == 0; /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?>

	<?php /* This outputs the next/previous post or page navigation. 
	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
	bfa_center_content($bfa_ata['content_above_loop']); ?>

	<?php /* The LOOP starts here. Do this for all posts: */
	while (have_posts()) : the_post(); $bfa_ata['postcount']++; ?>
	
		<?php /* Add Odd or Even post class so post containers can get alternating CSS style (optional) */
		$odd_or_even = (($bfa_ata['postcount'] % 2) ? 'odd-post' : 'even-post' ); ?> 

		<?php /* This is the actual Wordpress LOOP. 
		The output can be edited at Atahualpa Theme Options -> Style & edit the Center column */
		bfa_center_content($bfa_ata['content_inside_loop']); ?>
		<hr align=center>

<center><img src="http://www.larchmontgazette.com/wp27/wp-content/uploads/2009/12/plumezheader2.jpg"></center>
<p>Please <a href="http://larchmontgazette.com/careerdoctor/ask-the-career-doctor-a-question">click here</a> to ask the Career Doctor a question.</p>
						
	<?php /* END of the LOOP */
	endwhile; ?>

	<?php /* This outputs the next/previous post or page navigation and the comment template.
	This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
	bfa_center_content($bfa_ata['content_below_loop']); ?>

<?php /* END of: If there are any posts */
else : /* If there are no posts: */ ?>

<?php /* This outputs the "Not Found" content, if neither posts, pages nor attachments are available for the requested page.
This can be edited at Atahualpa Theme Options -> Style & edit the Center column */
bfa_center_content($bfa_ata['content_not_found']); ?>

<?php endif; /* END of: If there are no posts */ ?>

<?php bfa_center_content($bfa_ata['center_content_bottom']); ?>

<?php get_footer(); ?>

Last edited by paulae; Apr 24, 2010 at 07:29 AM.
  #4  
Old Apr 24, 2010, 08:34 AM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
I'm replying to my own post to see if Juggledad can jump in here.

What if, instead of making a custom post template, you could use a PHP statement in the ATO/Center Column insert area? What would the syntax be, to tell Wordpress to add some code only on posts in a certain category? This would make the Custom Posts Template plugin unnecessary, as well as the custom templates.

Let's say I'd like to add this to every Career Doctor (category 5) post, just before the comment area:
Code:
<hr align=center>

<center><img src="http://www.larchmontgazette.com/wp27/wp-content/uploads/2009/12/plumezheader2.jpg"></center>
<p>Please <a href="http://larchmontgazette.com/careerdoctor/ask-the-career-doctor-a-question">click here</a> to ask the Career Doctor a question.</p>
How would I use the PHP code to make that happen?
  #5  
Old Apr 24, 2010, 02:37 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try this
HTML Code:
<?php if (in_category('5')) { ?>
<hr align=center>
<center><img src="http://www.larchmontgazette.com/wp27/wp-content/uploads/2009/12/plumezheader2.jpg"></center>
<p>Please <a href="http://larchmontgazette.com/careerdoctor/ask-the-career-doctor-a-question">click here</a> to ask the Career Doctor a question.</p>
<?php }; ?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Apr 24, 2010, 03:34 PM
paulae's Avatar
paulae
 
1,333 posts · Feb 2009
Wordpress 3.4.1, Atahualpa 3.7.7
Beautiful! If I put that in the ATO/Center Column styling/below the loop, it's just where I need it. From a page-load point of view, do you think it's faster to do this, or to use the Post Templates plugin/special template combo?

Bookmarks

Tags
atahualpa, custom post template

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Disabling Link in Titles .. Revisited redacter Post-Kicker, -Byline & -Footer 7 Nov 8, 2010 06:10 PM
[SOLVED] post - custom field isa Forum How-To 0 Sep 17, 2009 02:44 PM
Category Page Revisited gungo Plugins & Atahualpa 12 Jul 28, 2009 12:36 PM
Custom post fields wwday3 Post-Kicker, -Byline & -Footer 8 Jul 28, 2009 11:39 AM


All times are GMT -6. The time now is 05:55 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.