Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

How to add PHP to the loop on multi- and single post pages only?

Old Jun 16, 2010, 02:24 AM
142 posts · Apr 2009
Hey -

I am using YARPP for realted posts and need to add this

<?php if (function_exists('related_posts')){ ?>
<?php related_posts();?>
<?php }?>

between the bodycontent and the footer. While I could do that in "Style and edit CENTER COLUMN", the related posts will also appear on archive pages, where I don't want them. I put that code between 'bodycopy' and 'pagination' - it works wonderfully if it were not for the archives pages. Is there a way to supress this for specific kinds of pages?
Old Jun 16, 2010, 03:44 AM
juggledad's Avatar
23,755 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
There is a wonderful resourse at http://codex.wordpress.org/Conditional_Tags - if youvisit it you will find there is an is_archive() tag, which you can use the "!" (NOT) with so you could code

HTML Code:
<?php if (function_exists('related_posts')){  
            if (!is_archive()) { related_posts();} } ?>
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
Old Jun 16, 2010, 04:55 AM
142 posts · Apr 2009
Thank you, juggledad. Shows I still got a long way to go to learn that PHP stuff. I expected the code in that ("Style and edit CENTER COLUMN") field to be ATA specific.


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
Thread Thread Starter Forum Replies Last Post
php in single post Haser Atahualpa 3 Wordpress theme 3 Dec 4, 2012 07:54 PM
How to add php code to a 'single' page JakeThePeg Center area post/pages 8 Mar 21, 2010 01:21 AM
[SOLVED] Removing Post Headline on Multi and Single Post Pages jen Center area post/pages 2 Jan 8, 2010 07:46 AM
How do I choose between Single Post Pages and Multi Post Pages? BradyKelly Atahualpa 3 Wordpress theme 2 Jan 3, 2010 05:17 AM
BUG: %comments(' ',' ',' ',' ') no longer works in FOOTER of Multi/Single Post(3.3.2) ianuy Post-Kicker, -Byline & -Footer 2 Apr 15, 2009 12:26 AM

All times are GMT -6. The time now is 01:30 AM.

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