Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Plugins & Atahualpa (http://forum.bytesforall.com/forumdisplay.php?f=16)
-   -   Why no single.php (http://forum.bytesforall.com/showthread.php?t=1024)

DavePorter Mar 30, 2009 08:25 PM

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

Flynn Mar 30, 2009 09:05 PM

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:

<?php if ( is_single() ) { ?>
YOUR CODE HERE
<?php ?>


DavePorter Mar 30, 2009 10:45 PM

Thanks Flynn - appreciate that
Dave

GlobalNeat Mar 24, 2010 07:46 PM

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' => '&raquo; ',
'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

juggledad Apr 3, 2010 05:13 AM

why are you surrounding your code witha set of quotes??

btrandolph Apr 23, 2010 06:45 PM

Quote:

Originally Posted by Flynn (Post 3871)
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:

<?php if ( is_single() ) { ?>
YOUR CODE HERE
<?php ?>


I am experiencing a related issue in attempting to add the new facebook "like" button to my posts. I inserted the code
<?php if ( is_single() ) { ?>
<iframe src="http://www.facebook.com/plugins/like.php?href=<?php echo
urlencode(get_permalink($post->ID)); ?>&amp;layout=standard&amp;
show_faces=true&amp;width=450&amp;action=like&amp; colorscheme=light"
scrolling="no" frameborder="0" allowTransparency="true" style="border:none;
overflow:hidden; width:450px; height:60px"></iframe>
<?php } ?>
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.