Hello @giovannicas
Your HTML formatting is incorrect. You are now looping a whole template including styles.
You should only loop over the <tr>
to add new items.
I’d advice you watch our introduction video to get more familiar with Pod templates:
https://docs.pods.io/videos/grow-beyond-posts-pages-introduction-pods-framework/
Cheers, Jory
Hi @keraweb,
thank you for your help. I wasn’t clear enough. I already tried to add the each shortcode to the <tr> items, but what I got is nothing. I updated the code with the each inserted so you can see. I already watched all the 3 videos to start with pods you and your team created. I don’t know why it’s not working. Note that I’m not using the archive page, but the shortcode to show multiple pods inserted in a normal page. I tried lot of things. The site is hosted with altervista, I tried to download it locally and putting the each shortcode, but did not work either, so I guess it’s not an hosting problem. I tried to change the custom field under the each, for example by putting [each post_title], but in this case it just does not show the post titles, and only the link with text “ALLEGATO”. I tried to use the template in the archive page, but does not work either (this time is not changing the default archive page instead). I don’t know if something is wrong with the code, but I don’t think so. What else should I try?
I will post the updated code with [each circolare] shortcode added, you can see the result at the link I posted in the previous message:
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 1px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
</style>
<table>
<tr>
<th>Titolo circolare</th>
<th>Download</th>
</tr>
[each circolare]
<tr>
<td>{@post_title}</td>
<td><a href="{@circolare_pdf._src}" target="_blank" rel="noopener">ALLEGATO</a></td>
</tr>
[/each]
</table>
Please note that if I add the [IF] shortcode, nothing is showing either. It’s like it can’t find the articles, I’m not sure why.
I’m updating the question as not solved, hoping you can help me with this. Have a nice day
Cheers, Giovanni
Hello @giovannicas
Not sure, but for some reason I think you have misunderstood how the Pods shortcode and templates work.
If you use the each
tag then the template should be a post which has a relationship field with that name.
Could you share the (short)code you use to display this template?
Cheers, Jory
Hi @keraweb,
Sure, this is the shortcode: [pods name=”circolare” template=”Circolari”]
Alright, so I think I’m doing something wrong here. This is not related to anything, it’s just a custom post type to be displayed on a page. You are telling me I can’t use each in this case, right?
Hi @giovannicas
You indeed misunderstood how it works.
The shortcode you use already loops through all circolare
posts.
In your case you’ll need to display the template on a single page and within that template you’ll need to run the loop for all circolare
posts.
The [each]
tag is always related to the current instance of a post/Pod so you cannot use it in this context as it’s not a relationship field, you are trying to pull all circolare
posts.
Also, pagination might be a challenge this way since the loop it within a table.
You could try the pagination
parameter in the loop shortcode and see what happens 🙂
https://docs.pods.io/displaying-pods/pods-shortcode/
Cheers, Jory
Alright @keraweb, awesome. I understood. I will try then and see what I can achieve.
Thank you for your help and patience.
I’m now marking this topic as solved.
Also congratulations for this free plugin and for the amazing support you are giving us customers. I will surely leave 5 stars!
Happy holidays, have a nice day
Cheers, Giovanni
Hi @giovannicas
No problem and thank you!
Good luck with your project and happy holidays!
Cheers, Jory