Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   How to add PHP to the loop on multi- and single post pages only? (http://forum.bytesforall.com/showthread.php?t=7607)

Fux Jun 16, 2010 02:24 AM

How to add PHP to the loop on multi- and single post pages only?
 
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?

juggledad Jun 16, 2010 03:44 AM

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();} } ?>


Fux Jun 16, 2010 04:55 AM

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.


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

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