Is it possible to tokenize theme options to make them available to the basic site editor

Ok through much research, I came up with a way to do this through my theme without having to create a separated plugin. First I set the options in the back end (I am using Redux Framework WP Plugin):

<?php
Redux::setSection('z_theme_opt', array(
    'title'     => esc_html__('Page Tokens', 'z_theme'),
    'id'        => 'opt_page_tokens',
    'icon'      => 'dashicons dashicons-html',
    'fields'    => array(
        array(
            'id'    => 'token_phone',
            'type'  => 'text',
            'title' => esc_html__('[[Phone_Number]]', 'z_theme'),
            'default'    => ''
        ),
        array(
            'id'    => 'token_email',
            'type'  => 'text',
            'title' => esc_html__('[[Email_Address]]', 'z_theme'),
            'default'     => ''
        ),

    ),
));

enter image description here

But however you set up your options is fine .. So long as you know the key the option is stored under. Here we’re using

token_phone
token_email

Then in my functions.php within the theme, I added a filter on the_content() … simply intercepting it

function filter_my_content($content) {
  $opt = get_option('z_theme_opt');

  $filter = [];
  $filter['[[Phone_Number]]'] = $opt['token_phone'];
  $filter['[[Email_Address]]'] = $opt['token_email'];

  foreach ($filter as $key => $val){
    $content = str_replace($key, $val, $content);
  }

return $content;
}

add_filter('the_content', 'filter_my_content');

So now in the editor .. Users can call these tokens any time they wish:

enter image description here

deneme bonusu veren sitelerbahis siteleripulibet girişdeneme bonusutürkçe altyazılı pornocanlı bahis casinocanlı bahis casino siteleriOnwin Güncel Girişholiganbetholiganbet girişholiganbet güncel giriş