Open hiviz opened 4 years ago
So you want to use this feature outside the loop templates?
Both inside and outside loop templates
For inside it is pretty simple: use {{name_of_custom_field}} and it will be replaced with the value. Currently it is not working with links... elementor eliminates the curly brackets from links now it seems.
Outside you need to make a content filter that you need to add it in functions.php that looks like this:
add_filter( 'the_content', 'filter_the_content_in_the_main_loop', 1 );
function filter_the_content_in_the_main_loop( $content ) {
// Check if we're inside the main loop in a single Post.
if ( is_singular() && in_the_loop() && is_main_query() ) {
return ecs_parse_content($content);
}
return $content;
}
Is the content filter added in functions.php essentially "manually" doing what the ACF plugin (https://www.advancedcustomfields.com) plugin does?
Actually is not limited only to ACF. Any meta key will work.
I see - and after you create your custom meta, you can dynamically call it into the loop template via the curly braces syntax?
Pretty much
Understood. Thanks very much!
https://dudaster.com/dynamic-everywhere/ shows one example of implementing Dynamic Everywhere feature.
Can you please provide more examples so I can study and emulate this feature for my own use case?
Additionally, the example provided is specific to Eletheme - i.e. the hook "ecs_vars" does not exist for any other theme. What hook should I be looking for when using any other theme?