Hi I have this code to display latest post by category the problem is when i had the same code inside a function so that I can use shortcode on the text editor, bet even thou I set a div and add the shortcode inside of it the function its just displaying at the twice at the top and bottom of all content. I just need to show once and exactly where I place within the div, can someone help me put please.
<?php
function wptuts_working_shortcode($atts, $content=null){?>
<div class="left home_bot_box"><!-- START LOOP TO DISPLAY LATEST POST ONLY-->
<h2>latest</h2>
<?php
global $more; // Declare global $more (before the loop).
$more = 0; // Set (inside the loop) to display content above the more tag.
?>
<?php
// set while loop to display only post of category latest-news and one post only per page
query_posts('category_name=latest-news&posts_per_page=1');
?>
<?php while (have_posts()) : the_post(); ?>
<p><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></p>
<p><?php the_content(__('more…')); ?></p>
</div> <!-- END LOOP FOR POST ONLY-->
<?php endwhile;
?>
<?php }
add_shortcode('working', 'wptuts_working_shortcode');
?>