Our developer has asked the following question.
How do you change attributes of partial anchor component using filters?
Many thanks!
Our developer has asked the following question.
How do you change attributes of partial anchor component using filters?
Many thanks!
On our site manifest-nirvana.com, we were previously on X version 7.2.3 and Cornerstone version 4.2.3.
We used filters to change the state of buttons here when an event was live:
The ENTER button would change to EVENT LIVE NOW when an event scheduled in MEC was live.
We updated to X 9.1.4 and Cornerstone 6.1.4, and since then this functionality is broken. Our developer identified that this issue is linked to filters that were available in Cornerstone 4.2.3.
Therefore he asks the question that opened this topic: how do you change attributes of partial anchor component using filters?
the cs_get_partial_view_anchor filter is not working in this version of Cornerstone.
Send the below code to your developer. I’m not sure when the filters for using those were removed, but it’s not available in CS 6 or CS 7 and you have to call the functions directly. Let us know if that helps!
$view = cs_get_partial_view('anchor', [ 'an-attribute' => 'test' ]);
https://theme.co/docs/element-api-reference The rendering view partials section.
@charlie many thanks for your helpful response, however this does not resolve our issue.
Was this a deliberate omission in newer versions of Cornerstone or is it just an oversight?
If it is intentional, can you let me know why support has been removed for this, and whether it can be restored in a future version?
Finally could let me know if there is something in Cornerstone we could leverage to achieve the same result?
You know I think I misunderstood what you are trying to do with that filter. Are you filtering all partial views for anchors and doing something custom with it?
I don’t think anybody here could tell me why this feature was removed, we’re talking years when this changed. I’m happy to bring back those filters though.
Can you send me a sample filter you are doing just so I’m sure I’m on the same page?
@charlie thank you so much for your help – it would be great if you could bring back those filters 
Here’s a sample of the code in our child theme functions.php:
add_filter('cs_get_partial_view_anchor', 'cs_get_partial_view_anchor_filter', 10, 2);
function cs_get_partial_view_anchor_filter($user_partial, $data)
We use category checkboxes on events to enable the rooms and halls, like this:

The relevant “room” (usually the Teaching Hall) opens for signed-in members when an event is ongoing. This changes the button state from ENTER to EVENT LIVE NOW. To open the rooms globally we have a checkbox in the Options menu – please check out stage site to see how this works if you need more detail (credentials in the secure note below).
For the time being, on our stage site the developer has done a quick-and-dirty fix to the Cornestone plugin to allow the functions to work.
Okay great this is what I was expecting. We’ll get those filters back in a release or two. You will need to upgrade to X10 (upgrade Cornerstone as well) so I would try that out in a staging server in the meantime and make sure you are all good. The hack your developer used will most likely work on X10 as well till this feature is back. Have a great day, glad we can help!
They will be back in Cornerstone 7.1.4. Coming out early next week. Let us know if you need anything else and have a great weekend.
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.