I'm on a post page and in addition I want to display a thumbnail, title, and link from all posts in the category titled "sponsor". I was able to display the thumbnail and title:
<a <?php echo ( !wp_is_mobile() )? 'target="_blank"' : '' ?> href="<?php _s( get_the_ID()) ?>"> <?php query_posts( array( 'category_name' => 'sponsor' ) ); if ( have_posts() ) while ( have_posts() ) : the_post(); echo '<li>'; the_post_thumbnail( 'big-thumb', array( 'alt' => get_the_title(), 'class' => 'img-responsive post-cover' ) ); the_title(); echo '</li>'; endwhile; wp_reset_query(); ?> </a>
BUT am unable to successfully get the right links for the posts within the category "sponsor". I tried using get_the_ID, but it is using the link from the post page that I'm on. From my research I think it's because I need to get the page ID outside the loop.
I'm a newbie when it comes to PHP so any help would be appreciated.