Tagged: custom post, shortcode
Hey,
i try to use shortcode to call data from a custom post with custom fields.
I can call the data on my page but the problem is that the genarated data is always on the start of the page.
Can you point me out what is wrong?
best regards,
leRenaar
Hey leRenaar,
I checked it and the problem is your shortcode [alto-posts], it should display (similar to echo) but only return the value, for example you have written it like this:
function alto_posts_shortcode( $args ) {
//some codes here
?>
<div class="myclass">text here</div>
<?php
}
it should be like this:
function alto_posts_shortcode( $args ) {
//some codes here
$output = "<div class="myclass">text here</div>";
return $output;
}
Try to rewrite your code to something like this and it should fix it :)
Best regards,
Nikko