My code:
// Add Shortcode
function NavotFloatingDiv() {
$nHeight = the_field('distance_from_top', 'options');
$nPadding = the_field('div_padding', 'options');
$nBackgroundColor = the_field('div_background_color', 'options');
$nDisplay = the_field('div-display', 'options');
$nDirection = the_field('left-right', 'options');
$nLink = the_field('divlink', 'options');
$nTarget = the_field('divlinktarget', 'options');
$nLinkTitle = the_field('divlinktitle', 'options');
$nContent = the_field('floating_div', 'options');
return '<div id="Navot-Float" class="NavotFlaot" style="z-index: 99999999999; position: fixed; padding:' . $nPadding . 'px; background-color:'. $nBackgroundColor .' ; display: ' . $nDisplay . '; ' . $nDirection . ': 0px ; top: '. $nHeightheight . '%;"><a href=". ' $nLink ' . " target=" ' . $nTarget .' " title=" '. $nLinkTitle .' "><div class="floater-navot-text"> ' . $nContent . '</div></a></div>';
}
add_shortcode( 'Floating DIV', 'NavotFloatingDiv' );
The information is stored, convinently with the Options page named Options. The goal is to create a mini-plugin for a floating DIV on the page in which the shortcode is placed. Dandy.
I can't quite find the problem right now, and I'd appreciate knowing what am I doing wrong in returning the HTML tags with the various retrieved variables.
the_fieldbyget_field, because the first display, and the second returnsadd_shortcodeshould not contain special chars (like spaces)<a href=". ' $nLink ' . "(the dots are poorly positioned).