- This topic has 1 reply, 2 voices, and was last updated 8 years, 4 months ago by .
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.
These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.
I'm having an issue getting my content to show up in the right place in a custom template. The code below is intended to display a user's content history, provided they're logged in to wordpress. I've tried playing around with the PHP, but no matter what I do the customized part will either show up above or below the full page Genesis template.
Any ideas on what I'm doing wrong?
<?php /* Template Name: User's Recent Comment */ if( is_user_logged_in() ) : global $current_user; get_currentuserinfo(); $querystr = " SELECT comment_ID, comment_post_ID, post_title, comment_content FROM $wpdb->comments, $wpdb->posts WHERE user_id = $current_user->ID AND comment_post_id = ID AND comment_approved = 1 ORDER BY comment_ID DESC "; $comments_array = $wpdb->get_results($querystr, OBJECT); if( $comments_array ): ?> <div class="entry-content"> <h2>Your Recent Posts</h2> <ul> <?php foreach ( $comments_array as $comment ): setup_postdata( $comment ); echo "<li><a href='". get_bloginfo( 'url' ) ."/?p=".$comment->comment_post_ID."'>Comment on ". $comment->post_title. "</a><br />". $comment->comment_content . "</li>"; endforeach; ?> </ul> </div> <?php endif; endif; genesis();?>
© 2023 WPEngine, Inc.