Hi i have a custom shortcode, but i really don’t know why my shortcode appear above the content, this is my code:
function paydown_func( $atts ) {
extract( shortcode_atts( array(
'id' => '',
'dialog' => '',
'header' => '',
'pay' => '',
), $atts ) );
if ($header == ''){
$header = 'OPTIONAL<br>DONATION';
}
if ($dialog == ''){
$dialog = 'Don't worry. This resource will always remain free. However I would appreciate if you share some support and help me to get some coffee. Thank you very much!!';
}
if ($pay == '') {
$pay = 'Donate $2';
}
$pay_content = '';
$pay_content .= '<div class="alert-gray">';
$pay_content .= '<div class="one-tf column-first"><span class="ptitle">'.$header.'</span><br>Via Paypal</div>';
$pay_content .= '<div class="one-ti column-inner psmall">'.$dialog.'</div>';
$pay_content .= '<div class="one-tl column-last">';
$pay_content .= '<a href="http://creativestocks.com/?pfd_checkout='.$id.'" target="_blank" class="button blue small alignright"><span class="button-inner">'.$pay.'</span></a>';
$pay_content .= '</div></div>';
return $pay_content;
}
If you are doing an
echo do_shortcode()
in your functions file, it will output the contents of the shortcode before the content. Usually the reason that you get the shortcode content above the page is because there is an echo in the wrong place.