Returning Variables back into a template

There’s filters for that.

Example:

add_filter( 'template_filter', 'wpse_102706_filter_callback', 10, 2 );
function wpse_102706_filter_callback( $defaults, $case )
{
    $args = wp_parse_args( array(
        'some_key' => 'some_modified_value'
    ), $defaults );

    return $args
}

Then in your template just add in the defaults:

apply_filters( 'template_filter', array( 'some_key' => 'default_val' ), 'single' );

More info in Codex about the Plugins API.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)