This is the website I'm working on:
versteckter Link
I have added custom fields to the posts for media coverage and speeches taxonomy.
For post types within those taxonomies where there is custom field data for that post I'm trying to get the content to show in one of two ways:
With Divi
I learned from a previous help topic to wrap my wp types code:
{!{types field='linked-file' output='raw'}!}{!{/types}!}
I have three data fields:
A file: linked-file
A single line: linked-file-name
A single line: linked-notes
And it no longer seems to work for the URL and Notes fields. It does output the name field.
. . . .
MY PREFERRED WAY:
I'd prefer to do this with the Blocks Builder so that I can conditionally hide the content if there is no file linked.
I've used a conditional 'if field' to wrap around showing a button, title with a link to a document and the notes fields. All of which are custom field data, same as written above. The logic is: If the linked-file is NOT empy show the following: URL active button, URL active name and static notes text.
Within the view I have set the View to display posts, and then Filter by post relationship or repeatable fields group owner, where the content comes from The post where this View is shown.
However as you can see 'no items found' yet the divi version shows the results clearly.
Can you help?
Thanks
Cathie
Hi Cathie,
Thank you for getting in touch.
Within the view I have set the View to display posts, and then Filter by post relationship or repeatable fields group owner, where the content comes from The post where this View is shown.
However as you can see 'no items found' yet the divi version shows the results clearly.
Based on what I see from your screenshot your Post is not in a relationship created with Toolset because there is a notice on the relationship filter.
Was a relationship setup between your Posts and another post type ? Can you send me a screenshot of your Toolset -> Post Relationship screen?
Finally if you remove this Relationship filter does the view start showing your posts?
Please let me know.
Thanks,
Shane
Hi Shane .. I've removed the relationship filter and now nothing shows up at all. I hadn't created a relationship I just wanted the view to pull in content from the current post where there view is shown.
Thanks
Cathie
Hi Cathie,
Would you mind allowing me to have admin access to the website so that I can have a more detailed look at this for you ?
Please where applicable please provide me with a link to an example page where I can see the issue.
I've enabled the private fields for your next response.
Thanks,
Shane
Hi there, I hope you're still able to help me?
Thanks
Cathie
Hi Cathie,
I'm currently having a look at his one for you.
The reason why your view isn't displaying anything is because your view isn't filtering for the current post.
I've added the Post ID query filter to your view and set it to get the id from the shortcode parameter "ids".
What you need to now do is go to the template where you're adding the view's shortcode and add the attribute ids="[wpv-post-id]"
Please let me know if this helps.
Thanks,
Shane
So when I'm using a shortcode to call up the view I should put it like this?
[wpv-view name="Press Media Document Link" attribute ids="[wpv-post-id]"]
the problem with the above is the last "] is output as text and the view fails and outputs a result 'no items found'.
versteckter Link
Hi Cathie,
Can you send me a direct link to edit the template for this posts?
I suspect the issue is that divi builder isn't able to process the nested shortcode so we would need to have a look at filtering the view through a hook.
Please send me the link for the edit template page for the template that is being used on your posts.
Thanks,
Shane
Hi,
This is the divi theme builder and its the third box on the top for 'all posts'.
versteckter Link
That's where I'm using a code block to use shortcode to pull through the view.
This is the view itself that is being called, that you helped edit to add the filter by ID's.
versteckter Link
Thank you,
Cathie.
You can see the 'speech' does have a document attached in the custom fields.
versteckter Link
Just in case you wanted to double check it.
Hi Cathie,
Please modify the shortcode and remove the the ids parameter from your view shortcode.
Then add the following to your site's functions.php file.
add_filter( 'wpv_filter_query', 'filter_basedon_page', 10, 3 );
function filter_basedon_page( $query, $settings, $view_id ) {
$postid = get_the_ID();
if ( $view_id == 5635 ) {
$query['post__in']= array($postid);
}
return $query;
}
Replace 5635 with the ID of your view. Unfortunately i'm not able to add this to your functions.php file as it seems I require FTP access to make this change.
Please try this code and let me know if it works.
Thanks,
Shane