I have a simple shortcode with simple output, which I am trying to display on an Archive Layout.
1. Theme is stock Toolset Starter - with the Real Estate Reference Site applied.
2. This shortcode is registered properly with Toolset.
3. I am using the Visual Editor cell to call the shortcode.
4. The shortcode works JUST FINE and outputs the correct information.
5. I have tried disabling all plugins except the Toolset specific ones required for output, with no help to the problem.
THE PROBLEM:
No matter how I apply it, the shortcode output is displaying at the TOP OF THE PAGE, above the Header. In Source, it is displaying directly below the Body tag.
No matter what I do, or how I wrap it, that's where it ends up.
You can see the shortcode below - it is applied only to Taxonomy Archives. It simply retrieves all terms assigned to the current Taxonomy, and lists them as links. Inside the Layout cell, I am simply placing the shortcode:
The output is very simple. <UL> / <LI> - nothing else.
If I place any other text or content within the same cell, above or below the shortcode, that content displays in the correct location just fine. But the shortcode output still ends up at the top of the page.
Why might this be happening and how to resolve it? Tx
function tax_terms_output( $atts ) {
$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
$taxonomy_slug = $term->taxonomy;
$terms = get_terms( $taxonomy_slug, array( 'hide_empty' => false ));
if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
echo '<ul>';
foreach ( $terms as $term ) {
echo '<li><a href="/'. $term->taxonomy .'/'. $term->slug .'/">' . $term->name . '</a></li>';
}
echo '</ul>';
}
}
add_shortcode('tax_list', 'tax_terms_output');