Why no single.php
Hi Everyone,
I'm learning to program plugins via the Packt Book 'Wordpress Plugin Development'. The first project is a simple Digg It plugin which works fine. But it want me to edit the single.php file to add the function ( Just as a first step, then it goes on to make it global ) But I notice there is no single.php in Atahualpa. I wondered why this is ? Can I assume that the functionality of single.php is in the index.php file ? regards, Dave Porter |
Yes, in Atahualpa everything is done by index.php.
You can make a copy of index.php as single.php (or page.php, category.php etc...) Or put your code into index.php with a conditional statement: PHP Code:
|
Thanks Flynn - appreciate that
Dave |
Hi Flynn
I am using the instructions within this thread to setup and use the 'Related Posts by Category' plugin. This code in red is what I have inserted into index.php, and also where I have placed it (not sure where in index.php to put it): <?php /* get all options: */ include (TEMPLATEPATH . '/functions/bfa_get_options.php'); get_header(); ?> <script type="text/javascript" src="http://forms.aweber.com/form/90/758182490.js"></script> <?php if ( is_single() ) { ?> ` <ul> <?php do_action( 'related_posts_by_category', array( 'orderby' => 'RAND', 'order' => 'DESC', 'limit' => 5, 'echo' => true, 'before' => '<li>', 'inside' => '» ', 'outside' => '', 'after' => '</li>', 'rel' => 'nofollow', 'type' => 'post', 'image' => 'thumbnail', 'message' => 'No matches' ) ) ?> </ul> ` <?php } ?> <?php /* If there are any posts: */ if (have_posts()) : $bfa_ata['postcount'] == 0; /* Postcount needed for option "XX first posts full posts, rest excerpts" */ ?> It isn't showing any 'related posts' in any posts. What do I need to do to get this to work? Any help is much appreciated. Thanks Neat |
why are you surrounding your code witha set of quotes??
|
Quote:
<?php if ( is_single() ) { ?>inside the loop section of index.php. the content appeared above the body, as seen here http://btrandolph.com/2010/04/go-jar...media-clients/. in addition, it appears only for my latest post. the link works as promised, it's just in the wrong place. I tried moving the section to different pleces above the loop end in the index.php file. I also tried putting it into the body section in the HTML/CSS inserts area of the options screens. I then removed it from everywhere. however, it is still showing up in the one post! I'd appreciate any suggestions. |
All times are GMT -6. The time now is 10:44 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.