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
- How do I get the attributes of a short code from a post?
- post__in – Placing content from a foreach loop inside of an array
- loop query exclude meta_key with meta_value
- “Blog pages show at most” in The Loop
- wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!
- Post Loop not Returning Permalink
- add_filter() doesn’t work in loop
- Content/Excerpt length control for a specific loop?
- Why we use if with while loop?
- Loop posts only excluding first post
- Loop repeating design pattern
- Why is my loop not dynamically grabbing the correct Category and displaying all categorized posts?
- Query posts if meta key starts with
- 3 Posts in Loop, Show Stickies First
- Loop within a loop (Again) for template
- sticky post in custom loop
- How to hide all child pages with post_query?
- Rating system and changing the loop
- Ajax Button to load more Posts into a timeline
- How to target thumbnails of the first post in the loop
- in Foreach Loop the Description is not showing?
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- Pulling in featured image into default recent posts widget
- How to check if there are posts with the same tag
- Modify loop output for a specific list of categories
- Loop info in jquery Tabs – loop into a variable?
- Adding $args to wp_schedule_event() causes hook to add infinitely to WP Cron
- $post is undefined in wordpress loop [ajax]
- Insert content above an embedded video inside Wordress’ php the_content
- the loop printing post in one grid
- Check value of post meta within IF statement
- Work arounds for conditional checks inside the loop in search.php?
- Get Sticky User in user loop based on user role
- Popular posts with Varnish ESI
- Querying posts from only one category and exluding the latest post
- query_posts ignores the argument
- Need some help with “the_widget()” function
- Exclude Authors based off date of last post
- Loop from another WP site onto mine
- Having issue with WordPress loop
- Wrap every 2 divs in row – for each loop [closed]
- How to add class to the last image of the last post in a loop
- Use Base-URL with Query-Loop