I solved it. Should be using elseif($tag->slug) instead of elseif($tag->name) or else it will never be true.
Related Posts:
- Exclude page name from loop
- get_page() unlike Loop returns the post content without html tags. How can I fix this?
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Child Pages Loop
- Get post by page name or slug
- Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content
- Display subpages under parent page as a list within a loop
- Is including the loop necessary for page.php? [duplicate]
- Identify the page being shown while in The Loop
- Related Posts loop – offset
- If Loop has odd number of posts on last page Custom style for last post in it
- single page site with subpages
- How to loop through ALL pages?
- Get titles of all posts with current tags except current post
- taxonomy tags 404 to custom post types
- Loop and Page template : my WP_query don’t take args
- Create a loop that gets pages with their template
- Display content of page template (get_page)
- Loop after page content
- wp alchemy multiple image uploader output images to template
- A loop with all articles with certain text strings in tags
- How to show posts with multiple tags on tag.php?
- Get Page content to displayin Bootstrap Modal
- Problem getting current post tags to show in a widget
- How do I make a variable available inside partials?
- How to show more random posts if Tag has less than 3 posts
- Display Posts Only with Specific Tag
- Stepping through a foreach loop – adding +1 to the end of it so next time it loops it starts on item 2
- Include multiple page ids in loop
- Get post offset/posts page offset in single post page (outside the loop)
- how to replace get_template_part(‘loop’,’tag’) with explicit styled version?
- For each loop on every word in post
- First archive page with a few posts
- Include future posts in tags and in search
- Exclude page from loop results
- Print the whole page?
- WP_Query is only looping home page, not pages
- how to run loop in function.php that sends email based on specific conditions?
- Using has_tag() outside loop
- How do i create a list-posts-page?
- WordPress: query pages except remove one page
- Archive: Lists itself
- is it bad to copy the loop for a template?
- Get top Page IDs from menu and cycle through their child pages on a scroller
- Search – Check if post is a page on search page
- Show posts by tags excluding current post
- Structure and Display Content from Multiple Pages on Single Page
- Making a specific page wordpress compatable that is not index
- Default Template infinite loop of Title
- WordPress Tags in class
- Secondary loop cuts off at 10 posts?
- Have multiple loops on a page appear after/between page content
- get_template_part() to render single page Theme
- How to show only specific tag in wordpress loop
- Tag custom loop show posts
- How to do query_posts on tags pages
- Tags outside the loop
- Check to see if a field is within an array in twig
- Style first 3 posts differently and use a 2nd loop to get rest of posts / offset and pagination broken
- Multiple loops in set intervals with code in between
- Posts are not showing up on next page.
- Homepage Loop Somehow Breaks Styling Of Post Grid
- adding tax_query to $query_string
- How to create page that lists tags by initial letter?
- Custom loop not working in singular.php, working in other pages
- Loop Posts Outside of WordPress Installation
- WordPress with woocommerce custom query
- Create an archive page(loop) for edd products (music files) with an audio player?
- Display product attributes for current product
- WordPress Pages in an Array
- Loop shows post 5 times in a query
- Get featured image outside the loop using foreach
- Get Sticky User in user loop based on user role
- Popular posts with Varnish ESI
- Retrieving category pages from subcategory returns empty sets
- Querying posts from only one category and exluding the latest post
- Attachment Metadata inside of Loop
- How can I make this iterative conditional within the Loop work via function?
- Posts Per Page is Not Returning Correct Number
- Infinite Loop after Genesis Theme Upgrade
- Modify widget to output posts in custom order
- Alternative layout the loop
- Why loop renders only last metabox from array? [closed]
- Cant pull in featured Image
- How to execute custom loop before loop content?
- Page gets displayed in post field
- Repeat code, change variable?
- the_content() keeps repeating itself
- Custom Looping of WordPress Posts
- Foreach loop inside foreach loop?
- Show different Google Map markers for different post_meta values
- how to place Post and page content side by side
- Add specific class to featured posts
- Adding options to loop
- Make custom WordPress comments list
- Attach link to pages accoding to tags
- numberposts not responding to wp_reset_postdata()
- Echo Most Recent Sticky Post in Loop?
- Template included with plugin doesn’t return all posts for custom taxonomy
- Search Page: activate html code if the tag is on the page