loader loader

Tonjoo Tom Theme Integration

In this tutorial we will guide you how to integrate Tonjoo Theme Options Maker (TTOM) into your WordPress Theme. Please note that the current version of TTOM is only come in plugin version. So every theme using TTOM must have TTOM installed on their plugin.

CREATE AN OPTION FILE

We need a fresh copy of TTOM plugin,  and then copy and paste tonjoostudio_options.php from tonjoostudio-tom/sample-options to your theme.

MODIFY tonjoostudio_options.php 

The tonjoostudio_options.php consisting of 3 function :

MODIFY WP EDITOR BEHAVIOR

You can specify the behaviour of WP Editor by changing the array key and value on the tonjoostudio_tom_default() function. For example we can change the font-size range or maybe change the available font options on WP Editor using font-face key

ADDING OPTIONS

To create a new options we must first define an Options Group. Each Options Group is defined by type => ‘heading’ on the options array. It will create a new tab on the Option Page.

Each time you define an option with type => ‘heading’  (Options Group),   every options bellow the $options will belong to the Options Group defined before.

To add an options you need to add this default template to the $options array :

Supported type value is

  •  heading
  • text
  • textarea
  • select
  • select tag
  • select-image
  • radio
  • upload
  • checkbox
  • multicheck

The tonjoostudio_options.php default file have many sample of default options available.

CHANGING THEME OPTIONS MENU NAME 

Most of the time, you will need to change the name of the Theme Options name on the WP Admin side. To do this you just need to modifiy your tonjoostudio_tom_config() functions on your tonjoostudio_options.php file.

ENABLE ADS ON OPTIONS PAGE

TTOM currently supports custom ads on the options page, so you can create your own ads on theme options page. the default of this feature is disabled. to activate it you need to add this code to tonjoostudio_tom_config(); function on tonjoostudio_options.php file located on your active theme.

and add the URL endpoint ads with code:

Url endpoint must have a return value as jsonp with parameters :

permalink_promo_1 (link for 1st ad),
permalink_promo_2 (link for 2nd ad),
img_promo_1 (image url of 1st ad),
img_promo_2 (image url of 2nd ad)

Example of return value:

to make a jsonp callback to your ads, simply create an array of parameters and print it using json_encode :

Example :

 


facebooktwittergoogle_plusredditpinterestlinkedinmail
  • http://dreamboxstudio.us/ Azhar Pratama

    wow mantap gan! 😀