Skip Navigation

[Resolved] add class in view loop

This support ticket is created 4 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.

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 7 replies, has 2 voices.

Last updated by breo 4 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#1904083

Hello!

It is the first time I use Toolset and I'm very grateful for this plugin.

I have one problem that I can't solve for myselft or find any documentation: I'm tryng to add the post terms (slug) in the contentor class of each post in all views loop.

For example, need to edit this loop element:
<div class="wp-block-toolset-views-view-template-block wpv-block-loop-item php-to-be-replaced-with-shortcode">
for this:
<div class="wp-block-toolset-views-view-template-block wpv-block-loop-item php-to-be-replaced-with-shortcode post-category-term-1 post-category-term-2 post-category-term-3 post-category-term-4">

Could also change this <div> element for a <article> or erase it from the loop?

Also, I need to know how to change the class "php-to-be-replaced-with-shortcode", I didn't find any documentation in Toolset.

Thank you very much

#1904357

Shane
Supporter

Languages: English (English )

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

Hello,

Thank you for getting in touch.

You are able to add a custom css class here, If you use the black navigation tool on the top left hand side of your screen, you will click on the View Loop.

Then navigate to the advanced tab where you will see a section to add your custom css classes.

Secondly i'm not seeing where you can remove the "php-to-be-replaced-with-shortcode". I've created a ticket with our 2nd tier supporters so that they can gather some information about this class to see what its purpose is.

Thanks,
Shane

#1904367

Thanks, Shane.

I will wait for the origin of "php-to-be-replaced-with-shortcode".

But, how can I add dynamically the classes "post-category-term-2 post-category-term-3 post-category-term-4" (the terms slug of each post) in each item inside the loop? Until now, I only konw how do it manually, as you explained.

#1904407

Shane
Supporter

Languages: English (English )

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

Hello,

You won't be able to do this dynamically with the Blocks setup. This is something only possible with the classic editor for views.

If you go to Toolset->Settings and under Editing Experience select the 3rd option.

From there you should see the views item appearing once you refresh the page. Next just go to Toolset -> Views and create your new view.

Now you will need to use the Loop output editor to add the items to this view. Finally you can add the shortcode for the taxonomy inside the generated output.

Example


<wpv-loop>
<div class="[wpv-post-taxonomy type='category']">
</wpv-loop>

Please let me know if this helps.

Thanks,
Shane

#1904511

Yes, it resolved the issue. Thanks

#1905343

Shane
Supporter

Languages: English (English )

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

Hello,

I got some information from our 2nd tier supporters. So the class "php-to-be-replaced-with-shortcode" is left over from development and is marked for deletion by our development team.

This class essentially serves no purpose at the moment.

Thanks,
Shane

#1905357

Great, Shane. Thanks you so much.
A sugestion ;-): the possibility of replace this class by a shorcode or by php code, I think it will be a good idea hehehe
Thanks again!
Great suport!

#1905359

My issue is resolved now. Thank you!