Possible to unlink tags with post total less than 2?

dethfire

Customer
I have a ton of random tags with only one post attached. Is it possible to unlink 1 post tags in thread_view?
 

Russ

Pixel Exit Staff
I guess one way of doing it is this:

Template tag_macros
Find:
Code:
                        <a href="{{ link('tags', $tag) }}" class="tagItem tagItem--tag_{$tag.tag_url}" dir="auto">
                            {{ $highlightTerm ? highlight($tag.tag, $highlightTerm) : $tag.tag }}
                        </a>
Replace with:

Code:
                        <xf:if is="count($tags) ==1">
                        <span class="tagItem tagItem--tag_{$tag.tag_url}" dir="auto">
                            {{ $highlightTerm ? highlight($tag.tag, $highlightTerm) : $tag.tag }}
                        </span>
                        <xf:else />
                        <a href="{{ link('tags', $tag) }}" class="tagItem tagItem--tag_{$tag.tag_url}" dir="auto">
                            {{ $highlightTerm ? highlight($tag.tag, $highlightTerm) : $tag.tag }}
                        </a>
                        </xf:if>

I think it works (requires a page refresh if you edit the tags directly on the page though.
 

dethfire

Customer
hmmm I had to add in the foreach loop and even then it's not working as expected. I think the count() function doesn't work.

Code:
<xf:if is="$tags">
                    
                    
                                            <xf:if is="count($tags) ==1">
                                                 <xf:foreach loop="$tags" value="$tag">
                        <span class="tagItem tagItem--tag_{$tag.tag_url}" dir="auto">
                            {{ $highlightTerm ? highlight($tag.tag, $highlightTerm) : $tag.tag }}
                        </span>
                    </xf:foreach>
                      
                        <xf:else />
 <xf:foreach loop="$tags" value="$tag">
                        <a href="{{ link('tags', $tag) }}" class="tagItem tagItem--tag_{$tag.tag_url}" dir="auto">
                            {{ $highlightTerm ? highlight($tag.tag, $highlightTerm) : $tag.tag }}
                        </a>
                    </xf:foreach>
                        </xf:if>
                <xf:else />
                    {{ phrase('none') }}
                </xf:if>
 

Russ

Pixel Exit Staff
Definitely seems to be working for me:

Hcc3MDk.png


What is it doing for you?
 

dethfire

Customer
ahhh miscommunication, I meant unlink the tag if that tag is used only in that post. aka why link to a page that only references the post they are already looking at.
 

Pre-Sale Questions

If you have any questions or concerns you want to ask before you make a purchase don't hesitate to use one of our multiple support channels for your convenience.