Skip Navigation

[Resolved] 's appear everywhere after adding conditional code

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 3 voices.

Last updated by szymonF 2 years, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2244547

Hi Minesh,

Thanks again for looking into this.

I know there are some <br> tags in the script. These are the breaks I want. Obviously, I am not referring to those ones. The ones I am referring to are not in the script, but are in the rendered site. Naturally, I want the breaks and paragraphs I add, not any other ones.

Perhaps I should point to them more specifically. Please compare the following snippets of code:

1a. what I put in the Content Template:

<div class="article-export">
<a href="<em><u>hidden link</u></em> field="philpapers-id"][/types]&formatName=BibTeX"target="_blank"><div class="sprite" id="sprite-ref-bibtex"><span class="nope">Export citation in BibTeX format</span></div></a>
<a href="<em><u>hidden link</u></em> field="philpapers-id" output="raw"][/types]&formatName=formatted%20text"target="_blank"><div class="sprite" id="sprite-ref-txt"><span class="nope">Export text citation</span></div></a>
<a href="<em><u>hidden link</u></em> field="philpapers-id" output="raw"][/types]"target="_blank"><div class="sprite" id="sprite-ref-philpapers"><span class="nope">View this text on PhilPapers</span></div></a>
<a href="<em><u>hidden link</u></em> field="philpapers-id" output="raw"][/types]"target="_blank"><div class="sprite" id="sprite-ref-reference-manager"><span class="nope">Export citation in Reference Manager format</span></div></a>
 <a href="<em><u>hidden link</u></em> field="philpapers-id" output="raw"][/types]"target="_blank"><div class="sprite" id="sprite-ref-endnote"><span class="nope">Export citation in EndNote format</span></div></a>
<a href="<em><u>hidden link</u></em> field="philpapers-id" output="raw"][/types]"target="_blank"><div class="sprite" id="sprite-ref-zotero"><span class="nope">Export citation in Zotero format</span></div></a></div>

1b. what comes out in the rendered page:

<div class="article-export">
<a href="<em><u>hidden link</u></em>" target="_blank"><div class="sprite" id="sprite-ref-bibtex"><span class="nope">Export citation in BibTeX format</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a><a href="<em><u>hidden link</u></em>" target="_blank"></a></p>
<a href="<em><u>hidden link</u></em>" target="_blank"><div class="sprite" id="sprite-ref-txt"><span class="nope">Export text citation</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a><a href="<em><u>hidden link</u></em>" target="_blank"></a></p>
<a href="<em><u>hidden link</u></em>" target="_blank"> <div class="sprite" id="sprite-ref-philpapers"><span class="nope">View this text on PhilPapers</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a><a href="<em><u>hidden link</u></em>" target="_blank"></a></p></strong>
<a href="<em><u>hidden link</u></em>" target="_blank"><div class="sprite" id="sprite-ref-reference-manager"><span class="nope">Export citation in Reference Manager format</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a> <a href="<em><u>hidden link</u></em>" target="_blank"></a></p>
<a href="<em><u>hidden link</u></em>" target="_blank"><div class="sprite" id="sprite-ref-endnote"><span class="nope">Export citation in EndNote format</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a><a href="<em><u>hidden link</u></em>" target="_blank"></a></p>
<a href="<em><u>hidden link</u></em>" target="_blank"><div class="sprite" id="sprite-ref-zotero"><span class="nope">Export citation in Zotero format</span></div></a>
***<p><a href="<em><u>hidden link</u></em>" target="_blank"></a></p>
</div>

==========

2a. what I put in the Content Template:

<div class="article-links">
            [wpv-conditional if="( $(wpcf-link) ne '' )"]<a title="Link to published version of the text" target="_blank" href="[types field='link' output='raw'][/types]" rel="noopener noreferrer">Full text</a>[/wpv-conditional]
            [wpv-conditional if="( $(wpcf-free) ne '' )"]<a title="Link to open access version of the text" target="_blank" href="[types field='free' output='raw'][/types]" rel="noopener noreferrer">Read free</a>[/wpv-conditional]
            [wpv-conditional if="( $(wpcf-find) ne '' )"]<a title="Link to syllabi where the text is used" target="_blank" href="[types field='find' output='raw'][/types]" rel="noopener noreferrer">See used</a>[/wpv-conditional]
            </div>

2b what comes out in the rendered page:

<div class="article-links">
            <a title="Link to published version of the text" target="_blank" href="<em><u>hidden link</u></em>" rel="noopener noreferrer">Full text</a>
***<br>
            <a title="Link to open access version of the text" target="_blank" href="<em><u>hidden link</u></em>" rel="noopener noreferrer">Read free</a>
***<br>
            <a title="Link to syllabi where the text is used" target="_blank" href="<em><u>hidden link</u></em>" rel="noopener noreferrer">See used</a>
            </div>

All the lines starting from *** is NOT in my script. That is the stuff I want to get rid of, not the breaks that I intentionally added.

#2246007

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

I've added the following JS code to content template's JS editor:
=> hidden link

jQuery(function($){
 $('p:empty').remove();
  
    $(".article-use").find("br").remove();
    $(".article-export").find("p").contents().unwrap(); 
  
});

And following CSS code to the CSS editor:

.article-export{
	width:auto;
	float:right;
}

Can you please confirm it works as expected now: hidden link

#2246185

Thanks! I guess this is a brute-force solution for now - I tweaked it a bit to look good, but it works. I hope this incompatibility might be resolved at source in the future!