Title: Every titles are same
Last modified: June 13, 2017

---

# Every titles are same

 *  Resolved [allangf](https://wordpress.org/support/users/allangf/)
 * (@allangf)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/every-titles-are-same/)
 * _[ Moderator note: [moved to Fixing WordPress](https://wordpress.org/support/topic/before-posting-in-everything-wordpress/?view=all).]_
 * When I get the title using this code every titles are same, I tried another method
   but don’t work too `get_the_title($post)` don’t shows any title.
 *     ```
       <?php
         $blockquotes = array('blockquote-green', 'blockquote-blue', 'blockquote-red', 'blockquote-yellow');
         $args = array( 'numberposts' => -1);
         $posts= get_posts( $args );
         /* for - used possible display the posts with a beautiful layout */
         if ($posts) {
           for ($i = 0; $i < count($posts) ; $i++ ) {
             $post = $posts[$i];
             setup_postdata($post);
             ?>
             <br>
             <!-- Get Post URL-->
             <a href="<?php the_permalink($post) ?>">
               <h4> 
                 <?php
                 the_title();
                 ?>
               </h4>
             </a>
             <blockquote class="<?php echo $blockquotes[$i % count($blockquotes)] ?>">
               <?php
               the_excerpt();
               ?>
             </blockquote>
             <br>
             <?php
           }
         }
         ?>
       ```
   
 * ![https://drive.google.com/open?id=0B11wqrGqWJ66RzFWS1lpMXNSbFk](https://drive.
   google.com/open?id=0B11wqrGqWJ66RzFWS1lpMXNSbFk)
 * Thanks!
    -  This topic was modified 9 years, 2 months ago by [allangf](https://wordpress.org/support/users/allangf/).
    -  This topic was modified 9 years, 2 months ago by [allangf](https://wordpress.org/support/users/allangf/).
    -  This topic was modified 9 years, 2 months ago by [Jan Dembowski](https://wordpress.org/support/users/jdembowski/).

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [drixe](https://wordpress.org/support/users/drixe/)
 * (@drixe)
 * [9 years, 2 months ago](https://wordpress.org/support/topic/every-titles-are-same/#post-9230865)
 * the_title() should be used within the Loop.
    Could you try the_title($post) as
   you do for the permalink ?
 *  Thread Starter [allangf](https://wordpress.org/support/users/allangf/)
 * (@allangf)
 * [9 years, 1 month ago](https://wordpress.org/support/topic/every-titles-are-same/#post-9265757)
 *     ```
         <?php
         $blockquotes = array('blockquote-green', 'blockquote-blue', 'blockquote-red', 'blockquote-yellow');
         $args = array( 'numberposts' => -1);
         $posts= get_posts( $args );
         /* for - used possible display the posts with a beautiful layout */
         if ($posts) {
           for ($i = 0; $i < count($posts) ; $i++ ) {
             $post = $posts[$i];
             setup_postdata($post);
             ?>
             <br>
             <!-- Get Post URL-->
             <a href="<?php the_permalink($post) ?>">
               <h4>
                 <?php
                 echo get_the_title($post);
                 ?>
               </h4>
             </a>
             <blockquote class="<?php echo $blockquotes[$i % count($blockquotes)] ?>">
               <?php
               the_excerpt();
               ?>
             </blockquote>
             <br>
             <?php
           }
         }
         ?>
       ```
   
 * [@drixe](https://wordpress.org/support/users/drixe/) TKS.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Every titles are same’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [allangf](https://wordpress.org/support/users/allangf/)
 * Last activity: [9 years, 1 month ago](https://wordpress.org/support/topic/every-titles-are-same/#post-9265757)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
