I am doing a database ‘search and replace’ for a Custom Content Shortcode shortcode - eg, [field title-link id=19] - that created links. This has worked well with the following Loop opener:
<Loop type=page id="{Get local=post_in}">
except I now realise that some of the links created using the above CCS code were for a custom post type with the slug ‘people’ so the Tangible template I created doesn’t work for these links.
My question therefore is, is it possible to create a Loop that covers both the page and people types in one Loop? I tried <Loop type=page,people id="{Get local=post_in}"> but that doesn’t work.
I think you can only specify one type for a loop because that affects everything that comes after it.
However, you can write a loop without a type, which will default to the loop type for that page/post/archive. So perhaps you can fix this by removing the type=page parameter.
Not the cleanest solution, but it’s also possible to use an If statement to activate a loop that fits the page type:
<!--Check if post-->
<If singular="post" type="post">
<Loop>
<Field title />
</Loop>
<!--Check if page-->
<Else if singular="post" type="page" />
<Loop>
<Field title />
</Loop>
<!--Check if archive-->
<Else if taxonomy="category,tag" />
<Loop>
<Field title />
</Loop>
<!--Report config issue-->
<Else />
<p>Type not configured.</p>
</If>
Thank you for your suggestions Phil. I still get nothing if I remove the type parameter. It still works for the page links but nothing is displayed for the custom post links. It doesn’t even work if I create a new template, just for the custom post type, like this:
Can you see anything wrong with this? As it works fine for the page links I am wondering if something inside the loop should be different for custom posts and so is breaking it?
Hi Ralf. I did try that (didn’t work), but I think the problem is with the type ‘people’ - I think I may have the wrong slug so I am just checking this with the Team Showcase plugin developer
I deleted my comment above because it was wrong. The solution to not include a type in the Loop does not work for the page or custom post type link. Apologies…
Hi Phil. I have just heard back from the plugin developer and found out what the slug should be (it’s tshowcase in case anyone else needs to know). Now everything is working as you would expect. I’m so sorry for wasting people’s time (I’ve learnt a little lesson about troubleshooting with a simple Loop first to narrow down the issue).
Thanks for all your support