I have a view that gets filtered by a value sent via a VIEW_PARAM(accountid). (Screenshot of the query below. )
I need to use the value of that accountid in a shortcode that is used outside of the <wpv-loop>, like so:
[show-total5 show_difference='1' accountid='[Value of VIEW_PARAM(accountid)]'][/show-total5]
(See screenshot below.)
Is there any possible way to do that?
Minesh has supported me on this project. The [show-total] shortcode he helped develop works beautifully on a page that shows a single account where the accountid is provided to the custom code function by the query string. But in this case (work-in-progress at hidden link), multiple accounts get shown on one page, so we don't have an accountid in the query string.
Instead, [show-total5], in use in view 39998 needs to get the accountid to the custom-code "calculate_yearly_totals", which defines the show-total5 shortcode. If we can get the accountid coming from the VIEW_PARAM into the shortcode, calculate_yearly_totals should be able to use it with $atts['accountid'] and will work.
If it's just not possible, let me know and I can explain more of the relationships so perhaps we can figure out another way to get that accountid into the function.
Thanks for the reply. In this case, we're trying to get the View parameter (provided via a shortcode attribute), not a URL parameter. I tried it out, but it looks like [wpv-search-term param=''] may only work for an URL parameter.
In our case, in case you want to look at it (you should still have access to hidden link), in View 39945 (toolest-test-show-view-in-form) we use a shortcode to insert View 39998, like so:
In View 39998 (Yearly Totals - Amount Remaining for Account), we are using the showtotal5 shortcode (outside the loop) and are trying to get that View parameter sent from the shortcode into it. Here's my most recent attempt based on your reply:
But [wpv-search-term param="accountid"] isn't returning a value (see hidden link, where the value would show in purple if it worked). At first I thought it might be because I was calling it outside the loop, but I tried it in the loop as well and it doesn't return a value, so I'm thinking it only works for URL parameters.
Can you think of any way to get that View parameter? (Which is successfully getting sent and filtering the view.)
That's what I needed Minesh, that worked like a charm.
And for the benefit of whomever else may read this in the future, in my testing the [wpv-attribute] shortcode successfully brought in the parameter value both inside *and* outside the loop.