Re: Some valuable Tips with custom template
i have used this code to display the images from the post.
<?php if (bp_has_posts()) : ?>
<?php while (bp_has_posts()) : bp_the_post(); ?>
<?php
$szPostContent = $post->post_content;
$szSearchPattern = ‘~<img [^\>]*\ />~’;
// Run preg_match_all to grab all the images and save the results in $aPics
preg_match_all( $szSearchPattern, $szPostContent, $aPics );
// Check to see if we have at least 1 image
$iNumberOfPics = count($aPics[0]);
if ( $iNumberOfPics > 0 ) {
// Now here you would do whatever you need to do with the images
// For this example the images are just displayed
for ( $i=0; $i < $iNumberOfPics ; $i++ ) {
echo $aPics[0][$i];
};
};
endwhile;
endif;
?>