I am using this shortcode to load a list of links to post per user profile or author:
/*
*
* Shortcode to display Post as links on Profile Pages
*
*/
function imwz_golfs_list_function( $atts ) {
if ( is_user_logged_in() ):
global $current_user;
wp_get_current_user();
$author_query = array('posts_per_page' => '-1','author' => $current_user->ID);
$author_posts = new WP_Query($author_query);
while($author_posts->have_posts()) : $author_posts->the_post();
?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php
endwhile;
else :
echo "not logged in";
endif;
}
add_shortcode( 'golfslist', 'imwz_golfs_list_function' );
Now it does work on Twenty Seventeen except for its position. However on the Total theme it is loaded just after the body tag as well on top of the positioning issue. So on both themes it is loaded before the main content and not as positioned in the post or page after the content using [golfslist]
in the WYSIWYG editor.
Any ideas how I can load the list where I want in the post by placing it in the editor? Any idea how it could be loaded in the post content and also just below the body tag?