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 */ I made all of the changes I wanted. I added them below: Code:
<?php /* This is the actual Wordpress LOOP. 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 */ |
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? |
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 |
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> |
try this
HTML Code:
<?php if (in_category('5')) { ?> |
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?
|
Depends on how you want to measure it. For absolute load time of the page, the template is probably faster. In terms on ongoing maintenance, putting it in the ato option will be less time consuming since you won't have to remember to do it during upgrades.
|
Paulae,
Thanks so much for following up on this topic. I was intending to create a highly customized template for a book reviews section (category) of the site. I was planning on creating and populating a number of custom fields for each review post, and I wanted to build a template to automatically concatenate and display the values of these fields. I would want most if not all of this customized content to appear at the beginning of the main body of the post, and then perhaps a second block at the end (like your example) that would feature information about the reviewer. This seemed simpler to design when those individual components were called out in the index.php. Now that the index.php doesn't list those component blocks of the body, I'm not sure how to customize it. You mention that there might be a plugin for that, but surely there's got to be a way to do it more "directly". Suggestions? |
Would the custom field values remain the same for each post in the category? If the info will be pretty static, why can't you just put it in a PHP statement as Juggledad showed us, in the Content Above the Loop area of the theme options/Center Column?
For the reviewer info, I believe there are some author bio plugins. For layout, you could try this plugin: http://wordpress.org/extend/plugins/post-layout/ I tried it on one site and it caused conflicts, but I use 2 of Satollo's other plugins (Newsletter and Hypercache) successfully, so maybe this one has been improved. |
Thanks for the ideas, Paulae and Juggledad. I was probably getting more complicated than I need to be initially. The site I'm working on might not ever take off, but I have been trying to work out some details at the start so that some higher level functions are possible if and when things scale up.
|
Don´t wont to hijack another thread - but seriously find it easier to search for threads with similiar problems than to open a new one each time - hope I am doing it right this time. :o
I have used a plugin already that allowed me to create meta custom fields, the plugin already has a function to limit the output to a selected category - and also an option to output the php code already - which I have attached below. The question is now, where do I have to add this code in order to appear as a meta box in all my postings - because under the above mented ATO/center area options is a message: Since 3.6.5 custom PHP code isn't possible anymore in the Atahualpa Theme Options PHP Code:
|
The code for new widget areas is allowed in many spots so you could create a new widget area and then use a plugin that allows php.
|
I have tried the "POST LAYOUT" Plugin already without any success. In my other blog I use "WIDGET ON PAGES" - maybe that might help, but I would need everything to appear in a kind of table like shown here on the left side of the review.
|
All times are GMT -6. The time now is 09:24 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.