I have a view that does the the following query filter at present:
"Select posts with taxonomy:
Categories the same as the page where this View is shown"
This lets me set the category in the view on the page when I use it, so each time I use this view I can pull data for a different category if I choose to in a post.
However, I have another view where I want to do a similar thing but with a custom field.
Same principle i want to set the custom field data on the view when I use it on a page. I can't seem to see a way to do this with a custom field? Is it not possible?
You would be setting a custom field value on a page, just to pass that value to the View to be used in a Query Filter?
It sounds like what you need is to pass the custom field as a View shortcode attribute, and wherever you insert the View you can provide a different attribute as required.
Say you had a custom field "status", and your View has a Query Filter for status. In the options for that filter you can specify that the value should come from a shortcode attribute. It would likely suggest something like wpvstatus for the attribute, but you can always change this.
Then when you insert your View you specify the status for that particular occurrence of the View, e.g.
A question on this, I want to use a custom field which will be the same for all the results outside the loop start and end of the loop but in the loop editor. As like a heading.
The custom field does not work though, is there a way to get this to work?
If the page where you insert the View has a custom field value then you could use that to provide the attribute value (e.g. in my example I would insert a shortcode to output the field to provide the value of wpvstatus in my wpv-view shortcode), or in the View you can output that custom field belonging to the page where you insert the View by specifying that in the post selection when you insert the field (screenshot), which will add an item="$current_page" attribute.
Does that cover what you mean? I wasn't sure what you are asking.
I have attached a screenshot to show you what I mean I think this will be much clearer.
From the screenshot you can see where I want to use the variable but it wont work and where it would work but I don't want it there as it would then repeat.
Right, well inside the loop the shortcode is taking the current post being iterated over as the source for the custom field.
Where you have it, outside the loop, there is no current post (or rather, the "current" post would be the page where you have inserted the View), so what should the shortcode treat as the source for the custom field?
Custom fields belong to posts, so which post should it be getting the value from?