Tell us what you are trying to do?
I have two repeating custom fields: field_resource_link_url and field_resource_link_title
I want to design a content template like:
Resource(s):
Resource file Title 1(linked to its URL)
Resource file Title 2(linked to its URL)
etc.
I can output either title or the other custom field url in a VIEW, but I can't seem to figure out how to show the repeating titles properly linked by their repeating url fields.
Using html, I was experimenting with [Any Label ShortCode]
but couldn't get it to work when I put the types shortcode in as:
'][/types]" >[types field='field_resource_link_title' separator='
'][/types]
Thanks for the help,
Martin
I forgot to mention that the reason I'm not using a 'FILE' field type is that this site is a migration of a large Drupal site using the FG Drupal to WordPress plugin and it created the two fields url and title which are populated with a lot of data...
(see image for field definition)
Dear Martin,
I assume we are talking about a repeatable field groups "my-rfg", with two custom fields:
- field_resource_link_url
- field_resource_link_title
Types repeatable field groups are based on one-to-many relationship, so each item is also a single post.
You try these:
1) Create a post view:
- query the posts of your repeatable field groups "my-rfg"
- filter by:
Select items from the my-rfg group that are related to the Post where this View is shown.
- In section "Loop Editor", display the file title and links like this:
<a href='[types field='field_resource_link_url' output='raw'][/types]'>[types field='field_resource_link_title'][/types]</a>
More help:
https://toolset.com/documentation/customizing-sites-using-php/functions/#url
‘raw’=Display raw data stored in DB. No other formatting attributes
Sorry, I'm still having a problem.
I don't want to create a view with all the values of "my-rfg" for all the related posts. I just want the the values of "my-rfg" for my current post.
How do I just show the repeated values of "my-rfg" using the nice code which you showed here:
<a href='[types field='field_resource_link_url' output='raw'][/types]'>[types field='field_resource_link_title'][/types]</a>
BUT just for the current post (not the related ones too).
[note: I tried what you said above with the view editor Query Filter "Filter by post relationship or repeatable fields group owner" but my choices are then
"Select items (choose a relationship) as related items of...
and I choose "The post where this View is shown"
BUT
that is incorrect because it assumes I also want records related in some way to the current one. It doesn't allow me to just pick the current record repeated values]
thanks,
Martin
I'm wondering if I have a group of repeating fields (URL and TITLE) rather than a repeatable field group. This database is created using the FG Drupal to WordPress plugin which while amazing may have missed this nuance.
Is it possible for me to change my field group of repeating fields into a repeatable field group or is there some other way around my problem of displaying the repeating field values in my "Resource" custom field type posts.
Ok, I figured it out using repeating fields. No view just shortcode block:
<ul>
[wpv-for-each field="wpcf-field_resource_link_url"]
<li>
<a href='[types field='field_resource_link_url' output='raw' ][/types]'>[types field='field_resource_link_title'][/types]</a>
</li>
[/wpv-for-each]
</ul>
However, could you please tell me why it might be better to use repeatable field groups in the future? Thanks.
For the question:
However, could you please tell me why it might be better to use repeatable field groups in the future?
repeatable field groups can contain multiple instances of multiple custom fields, but repeating field contains only one custom field in multiple instances.
For example you can setup repeatable field groups, like this:
- Item A. Title: Google, URL: google.com
- Item B, Title: Yahoo, URL: yahoo.com
...
See our document:
https://toolset.com/documentation/getting-started-with-toolset/creating-and-displaying-repeatable-field-groups/
My issue is resolved now. Thank you!