Skip Navigation

[Resolved] types termmeta shortcode inserts nonexistent paragraph tags

This support ticket is created 2 years, 1 month 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 13 replies, has 2 voices.

Last updated by kostasT 2 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#2311043

In a taxonomy archive, I want to display a description of the current taxonomy. So, I have a custom WYSIWYG field named "description" and I use the [types termmeta="description"] shortcode to display it under the page title. However, I notice that at the beginning and the end of the description content, there is an empty paragraph (<p>/<p>) that doesn't exist in the content. You can see it by checking the source as I used CSS :first-child and :last-child to hide them. You can check this page:

hidden link

This is the taxonomy item
hidden link

#2311291

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

Thank you for getting in touch.

Can you try wrapping your types shortcode in the shortcode below and let me know if it helps?

https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-noautop

Thanks,
Shane

#2311339

I tried [wpv-noautop][types termmeta="description"][/wpv-noautop]
The empty paragraphs are still in the output.

#2311645

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

I was able to remove the empty p tags but for some reason when I do the texts vanish as well.

Not sure why the empty p tags are tied to the text itself.

Are you experiencing this on any other archive page?

Please let me know.

Thanks,
Shane

#2311941

Hi,

I check it in 2 other laboratory categories and the problem is the same:
hidden link
hidden link

I haven't created yet another archive page for other post types.

I don't know what you did but there is a new problem on page
hidden link

After the "Sub-categories" header there is a text (2 paragraphs) that I don't know from where comes. I didn't do any changes to the template and the text is not visible on other pages.

#2312249

In fact, the text under the Sub-categories heading is also displayed on this page:
hidden link

#2312337

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

I looked a little deeper at the css for this page and found why the p tags were not displaying anything even when i've removed the empty ones.

It turns out there was some css that is setting the p tags to display none.

I've countered this by adding the following css.

.uagb-column__inner-wrap p{
display: block !important;
}

Then removed the empty tags with the following code.

jQuery('.uagb-column__inner-wrap p').each(function() {
         var jQueryp = jQuery(this);
 if(jQuery.trim(jQueryp.html())==='') {
        jQueryp.remove();
     }
});

Please let me know if this helps.
Thanks,
Shane

#2312459

Hi,

The p tags don't display anything because, as I wrote in my first message, I use a trick to hide the first and last empty paragraphs.

.col-text div.uagb-column__inner-wrap p:first-child, .col-text div.uagb-column__inner-wrap p:last-child {
display: none;
}

Is this what you mean by saying "I found why the p tags were not displaying anything even when i've removed the empty ones"?

Where should I put the code? In the functions.php?

What about the text under the Sub-categories heading that I mentioned in my previous 2 messengers?

#2312601

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

Hiding the first and last p tags won't do anything. You will need to remove this css.

Hiding them won't remove them from your page itself. Using the Javascript that I provided will. However once I removed the empty tags then the p tags with the content became the first and last tags.

I've already added this javascript to the JS editor of your archive template, so now all that is needed is for you to remove the css that you added and everything should be fine now.

Thanks,
Shane

#2312655

Hi Shane,

Yes you are right. As I told you my solution with the CSS rule was a workaround. What about the text that appears under the heading Sub-categories?

#2313373

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

What about the text that appears under the heading Sub-categories?

I'm not sure what you mean as the text there is still displaying as intended. Can you provide some clarification for me.

Thanks,
Shane

#2313427

Hi Shane,

In the page hidden link there is a h2 with the text "Sub-categories". After that there is the following text:

"Feugiat in ante metus dictum. Dignissim suspendisse in est ante in. Sit amet consectetur adipiscing elit pellentesque habitant morbi. Tellus id interdum velit laoreet id donec ultrices tincidunt arcu. Bibendum est ultricies integer quis auctor. Non odio euismod lacinia at quis. Metus aliquam eleifend mi in nulla posuere sollicitudin aliquam. Semper quis lectus nulla at volutpat. Pharetra pharetra massa massa ultricies mi quis hendrerit dolor magna. Nullam eget felis eget nunc lobortis mattis aliquam faucibus. Nisi est sit amet facilisis. In nulla posuere sollicitudin aliquam. Sodales ut eu sem integer vitae. Quis auctor elit sed vulputate. Natoque penatibus et magnis dis parturient montes nascetur ridiculus. Venenatis tellus in metus vulputate eu scelerisque felis.

Morbi tempus iaculis urna id volutpat lacus. Ullamcorper eget nulla facilisi etiam dignissim diam quis. A pellentesque sit amet porttitor eget dolor. Sed felis eget velit aliquet sagittis id consectetur purus ut. Et odio pellentesque diam volutpat commodo sed. Malesuada proin libero nunc consequat interdum varius sit amet mattis."

I spent a lot of time trying to find where this text comes from. It seems that this is the text from the "description" custom field of the last subcategory "Recirculators & Chillers". You can see the description here:
hidden link

Same here:
hidden link
hidden link

If you check the archive template, there isn't anything that could get this field. I'm not sure, but I think that it appeared after your changes.

#2313619

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Kostas,

Thank you for the clarity.

I found the issue.
You had this shortcode below in your laboratory category view.
[types termmeta='description'][/types]

Once I removed this then the text below the sub category was removed.

Please let me know if this helps.
Thanks,
Shane

#2316541

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.