use a permalink outside the loop
-
Any way to pull a link from the loop and apply it to another element?
For example,<div class="logo"><a href="want my link here">Logo</a></div> <?php $args = array( 'post_type' => 'post', 'post_per_page' => '10' ); $the_query = new WP_Query( $args ); ?> <?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?> <li><?php the_title(); ?></li> <?php endwhile; ?> <?php endif; // end have_posts() check ?>
I want the link to change on the logo from my 10 post elements.
It’s worth mentioning that I want to do this because the list is a rotating carousel. So only one list item is visible at a time. So i want the logo to represent the permalink of the visible list item.
- The topic ‘use a permalink outside the loop’ is closed to new replies.