Created
February 14, 2024 09:48
-
-
Save andreiglingeanu/0692b691a424f324fc302ed7a9c2650b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( | |
'blocksy:pro:content-blocks:condition-match', | |
function ($matches, $content_block_id) { | |
if ($content_block_id === 15054) { | |
$resume_id = get_queried_object_id(); | |
if (! resume_manager_user_can_view_resume($resume_id)) { | |
return false; | |
} | |
} | |
return $matches; | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is fantastic! The specific Content Block filter used is re-implementing the "View Resume Capability" setting of the WP Job Manager Resumes addon to a Content Block that is overriding the content-single-resume.php template file of that plugin. However, I can see how any content block filter can be added inside the callback function passed to the add_filter function. So this is also very useful across many other similar situations where we will want to add a filter to any Content Block for any reason!
I put this code in a content-blocks-controls.php file in the child theme and removed the content-single-resume.php template override from it. The view resume capability for the Content Block is again controlled by the WPJM Resume's setting.
Chef's Kiss Guys!