WordPress.org

Support

Support » How-To and Troubleshooting » custom tag page

custom tag page

Viewing 4 replies - 1 through 4 (of 4 total)
  • aminabbasian

    @aminabbasian

    Please see the codes now in pastebin

    aminabbasian

    @aminabbasian

    OK just an update on this.

    I have started editing tag.php as follows:

    $thumbnails = get_posts('numberposts=0&tag=Summer');
      foreach ($thumbnails as $thumbnail) {
        if ( has_post_thumbnail($thumbnail->ID)) {
          echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
          echo get_the_post_thumbnail($thumbnail->ID, 'gallery-220');
          echo '</a>';

    This code pulls all the tags under “Summer” but I want to be able to have this as an array of some sort. So that the page pulls the posts according to what the tags is.

    get_posts('numberposts=0&tag=$get_the_tags'); or get_posts('numberposts=0&tag=$tag'); doesn’t work.

    I know I can echo the tag as set out here http://codex.wordpress.org/Function_Reference/get_the_tags but how do i uses this to be included within the codes above?

    aminabbasian

    @aminabbasian

    ok figured it out!! 🙂

    this is the final code

    $posttags = get_the_tags();
    if ($posttags) {
      foreach($posttags as $tag) {
    
      $thumbnails = query_posts("numberposts=0&tag=$tag->name");
      foreach ($thumbnails as $thumbnail) {
        if ( has_post_thumbnail($thumbnail->ID)) {
          echo '<a href="' . get_permalink( $thumbnail->ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';
          echo get_the_post_thumbnail($thumbnail->ID, 'gallery-220');
          echo '</a>';
    
        }
      }
        }
    }
    aminabbasian

    @aminabbasian

    just an update on the code above.

    how can i alter the code so that it pulls the tag ID or tag slug?

    At the moment the tag name is pulled but if the tag name consists of two words the page search is blank.

    any suggstions?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘custom tag page’ is closed to new replies.