Forum Replies Created
-
AuthorPosts
-
MR MICHAEL BRIORDAN
ParticipantThanks!
MR MICHAEL BRIORDAN
ParticipantThank you. This works. However, I can't now work out how to get this working in MB Views, using Twig. What I have so far:
{% for item in post.fieldsetcopies %} {% if item.libplace %} {{ item.libplace }}, {% endif %} {% if item.lib %} {{ item.lib }}, {% endif %} {% if item.libshelf %} . Shelkmark: {{ item.libshelf }}, {% endif %} <!-- etc --> {% endfor %}My 'inputs' (subfields) are not appearing on the list of fields in views.
I've also experimented with for loops on each sub-field in the fieldset.
MR MICHAEL BRIORDAN
ParticipantI've worked this out myself. For benefit of others, make the field cloneable.
MR MICHAEL BRIORDAN
ParticipantMR MICHAEL BRIORDAN
ParticipantMR MICHAEL BRIORDAN
ParticipantMR MICHAEL BRIORDAN
ParticipantThanks for all your help on this, but it is still not working for me... The twig is not rendering at all.
Here is the source code of the rendered page:
<table> <tr> <th></th> <th>Date</th> <th>Title</th> <th>Location</th> </tr> <tr> <!-- not live so don't want to share URL publicly --> <!-- but this produces the URL of the listing page itself, not a link to the item page --> <td><a href="https://mysite.url/print-editions/">Detail</a> </td> <td><!--blank--></td> <td><!-- should render {{ post.year }}</td> <td><!-- should render {{ post.booktitle }} -- a custom field called 'booktitle' rather than the name of the post --></td> <td><!-- should render {{ post.location }}--></td> </tr> </table>I can provide the PHP for the post type or field group, if it helps...
MR MICHAEL BRIORDAN
ParticipantFirst code not rendering properly, it should be
<table> <tr> <th></th> <th>Date</th> <th>Title</th> </tr> {% for post in query.posts %} <tr> <td>Detail</td> <td>{{ post.year }}</td> <td>{{ post.booktitle }}</td> </tr> {% endfor %} </table>MR MICHAEL BRIORDAN
ParticipantI have followed this suggestion, with no output.
But I think I need a bit more explanation.
This code was intended for a view, editions-list, that lists not all posts, but only custom post type, "edition" each of which represents a post about a book. I've created this using MetaBox.
editions-list looks something like this (I've only given the first few fields):
<table>
<tr>
<th></th>
<th>Date</th>
<th>Title</th>
</tr>{% for post in query.posts %}
<tr>
<td>Detail</td>
<td>{{ post.year }}</td>
<td>{{ post.booktitle }}</td>
</tr>
{% endfor %}
</table>Type for editions-list is archive.
Location for editions-list is edition Archive.I then have created a second view, single-book-view, that gives a detailed view of each book.
single-book-view looks something like this (I've only given the first few fields):
<table> <tr> <td>Year</td> <td>{{ post.year }}</td> </tr> <tr> <td>Title</td> <td>{{ post.booktitle }}</td> </tr> </table>Type for single-book-view is singular.
Location for single-book-view is edition / allMR MICHAEL BRIORDAN
ParticipantI should note when I try and (edit a) post I get the following errors:
Warning: array_keys() expects parameter 1 to be array, null given in /home/.../wp-content/plugins/meta-box/inc/sanitizer.php on line 154
Warning: array_intersect(): Expected parameter 2 to be an array, null given in /home/.../wp-content/plugins/meta-box/inc/sanitizer.php on line 154
Warning: Cannot modify header information - headers already sent by (output started at /home/.../wp-content/plugins/meta-box/inc/sanitizer.php:154) in /home/.../wp-includes/pluggable.php on line 1281
-
AuthorPosts

