• Resolved inspiredwp2013

    (@inspiredwp2013)


    Hi i have this code of flexslider written in featureflexslider.php

    <?php
       // Get all sticky posts, but only sticky posts
       $sticky = get_option( 'sticky_posts' );
       $args = array(
            'numberposts' => 6, // Display up to 6 posts. Change at will
            'post__in'  => $sticky
             );
    	$postQuery = get_posts($args);
            foreach( $postQuery as $post ) : setup_postdata($post);
    
              if ( has_post_thumbnail() ) { ?>
    	    <li>
    		<a href="<?php echo get_permalink(); ?>" title="Go to <?           php echo the_title(); ?>" rel="bookmark">
    	       <?php the_post_thumbnail('feature-slider'); ?>
    		<p class="flex-caption"><?php the_title(); ?></p>
    
    		</a>
    	    </li>
    
        <?php}
    	endforeach; ?>

    now i want the current title of the flexslider to appear outside the <ul class=’slides’> but i don’t know how to do it. this is my code in my header.php file

    <div id="featured_posts">
      <div class="flexslider">
        <ul class="slides">
    
    	<?php get_template_part( 'featureflexslider' ); ?>
       </ul>
      </div>
        <?php //I WANT THE CURRENT POST TITLE TO APPEAR HERE ?>
    </div>

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    PHP has no way to know what the current title of the post being displayed is. This is the realm of javascript or jQuery. All you can do in PHP is provide a container in which a client side script can place the current title.

    The best way to get the current title would depend on how flexslider actually works. I’m afraid I have no idea aboout that.

    Thread Starter inspiredwp2013

    (@inspiredwp2013)

    @bcworkz

    thanks for the information, somehow i managed to put a relative position in css that makes the title float outside the box. and added a z-index value higher than the box..

    Moderator bcworkz

    (@bcworkz)

    Ah! I see now, I misunderstood the question. I’m glad you got it sorted out, thanks for coming back and marking resolved.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘get the title from current loop of flexslider’ is closed to new replies.