2020-08-26, 22:28:40
There is no such a hook exists. There is a function get_component(), but it is really useless because it does not return the component but processes it immediately (should normally be named "exec_component"). Don't waste your time on it, rather create a custom function/plugin instead.
You can execute your function on any action and alter the content of your component:
And the function may look like this:
You can execute your function on any action and alter the content of your component:
PHP Code:
add_action('theme-header', 'modify_component', array('your-component-slug'));
And the function may look like this:
PHP Code:
function modify_component($id) {
global $components;
if(!$components) {
$components = array();
if(file_exists(GSDATAOTHERPATH.'components.xml')) {
$data = getXML(GSDATAOTHERPATH.'components.xml');
$components = $data->item;
}
}
foreach($components as $component) {
if($component->slug == $id) {
$newValue = 'New component value';
$component->value = $newValue;
}
}
}