request: return (not echo) the output
-
Hi,
To prevent the output (list of sites) showing before (above) the post content where the shortcode is placed, use return instead of echoing the list from within the shortcode function.
The end of the main function would then look like this (with class added to allow custom styling) :
[...] $echo = "<ul class=\"site-list\">"; while (list($key, $value) = each($siteList)) { $echo .= "<li><a target=\"_blank\" href=\"https://" . $value . "\">" . $key . "</a></li>"; } $echo .= "</ul>"; return $echo; } else { return ""; } }
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘request: return (not echo) the output’ is closed to new replies.