Buonasera ragazzi,
allora, vado subito al punto, ho un problema per quanto riguarda al loop del php (che non sono per niente ferrato...volevo evitarlo ma sono arrivato al punto che mi serve... :S) con WORDPRESS.
vi spiego:
ho bisogno che il codice php faccia questo tipo di output:
codice:
{image : 'image.jpeg'},
{image : 'image.jpeg'},
{image : 'image.jpeg'}
ATTENZIONE: da vedere che l'ultima riga NON ha la virgola.
e tramite questo ho creato questo codice:
Codice PHP:
<?php query_posts('cat=46'); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<?php
if ($postid<1) $postid = get_the_ID();
if ($images = get_children(array(
'post_parent' => $postid,
'post_type' => 'attachment',
'order' => 'DESC',
'numberposts' => -1,
'post_mime_type' => 'image',)))
foreach($images as $image) {
$attachment=wp_get_attachment_image_src($image->ID, $size);
?>{image : '<?php echo $attachment[0]; ?>'},
<?php } ?>
<?php endwhile; else: ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
come vedete alla 5 riga a partire dal basso, se faccio così, ad ogni riga spunta la virgola...ed è ciò che mi crea problemi..
volevo capire che codice posso fare per poter rimuovere l'ultima virgola DELL'ULTIMA RIGA...
spero di avervi capito!
Grazie,
Francesco