• Resolved iopmarketing

    (@iopmarketing)


    I would really like to be able to list all the tags, then list all of the Pages that include the tag. So one page may be listed under two different tags. The alphabet should be replaced with the tags as headers.

    Also, I would only like to display tags that exist on pages. So… like this.

    Page 1 has tag 1, tag4, tag5, tag6
    Page 2 has tag 1, tag5

    -tag1
    –Page 1
    –Page 2

    -tag4
    –Page 1

    -tag5
    –Page 1
    –Page 2

    -tag6
    –Page 1

Viewing 1 replies (of 1 total)
  • Plugin Author tugbucket

    (@tugbucket)

    hmmmm…. that would take a lot of customizing and it’s not really in the scope of what this plugin does. Better to just roll your own for something this specific.

    Here’s a small starter snippet that lists Pages under the respective tag it has.

    $tags = get_tags();
    foreach($tags as $tag){
    	$the_query = new WP_Query( 'posts_per_page=-1&order=ASC&post_type=page&tag_id='.$tag->term_id);
    	if ( $the_query->have_posts() ) {
    		echo '<div>'.$tag->name.'</div>';
    		echo '<ul>';
    		while ( $the_query->have_posts() ) {
    			$the_query->the_post();
    			echo '<li>' . get_the_title() . '</li>';
    		}
    		echo '</ul>';
    	} else {
    		// no posts found
    	}
    	wp_reset_postdata();
    }
Viewing 1 replies (of 1 total)
  • The topic ‘Pages UNDER tags’ is closed to new replies.