How to extend the Theme Options

Marketplace Forums Themes Cannyon Cannyon Premium How to extend the Theme Options

This topic contains 2 replies, has 1 voice, and was last updated by  mythemes 6 years, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3273

    mythemes
    Keymaster

    you can create your own page with options or you can extend a page with options.

    create new file:
    cannyon_/cfg/pages/custom-page.php

    include it to:
    cannyon_/cfg/pages.php

    < ?php
    get_template_part( 'cfg/pages/general' );
    get_template_part( 'cfg/pages/header' );
    get_template_part( 'cfg/pages/blog' );
    get_template_part( 'cfg/pages/layouts' );
    get_template_part( 'cfg/pages/custom-sidebars' );
    get_template_part( 'cfg/pages/social' );
    get_template_part( 'cfg/pages/footer' );
    get_template_part( 'cfg/pages/others' );
    
    get_template_part( 'cfg/pages/custom-page' );
    ?>
    

    page content:

    <?php
    $pages  = mythemes_cfg::get_pages();
    
    $cols   = array();
    $boxes  = array();
    $sett   = array();
    
    $pages[ 'mythemes-custom-page' ] = array(
        'menu' => array(
            'label'     => __( 'Custom Page' , 'cannyon_' )
        ),
        'cols'  	=> & $cols,
        'boxes' 	=> & $boxes,
        'sett'  	=> & $sett
    );
    
    mythemes_cfg::set_pages( $pages );
    
    {	/* FULL COLUMN */
    
    	{	/* BOX */
    
    		$boxes[ 'box-1' ] = array(
                        'title' => __( 'The box Title 1' , 'cannyon_' ),
                        'sett'  => array(
                        )
                    );
    
    	}
    
    
    	$cols[ 'full' ] = array(
                'box-1'
            );
    }
    
    mythemes_cfg::set_sett( array_merge( mythemes_cfg::get_sett() , $sett ) );
    
    ?>
    
    #3274

    mythemes
    Keymaster

    Add option like upload logo

    < ?php
    $pages  = mythemes_cfg::get_pages();
    
    $cols   = array();
    $boxes  = array();
    $sett   = array();
    
    $pages[ 'mythemes-custom-page' ] = array(
        'menu' => array(
            'label'     => __( 'Custom Page' , 'cannyon_' )
        ),
        'cols'  	=> & $cols,
        'boxes' 	=> & $boxes,
        'sett'  	=> & $sett
    );
    
    mythemes_cfg::set_pages( $pages );
    
    {	/* FULL COLUMN */
    
    	{	/* BOX */
    
                    
                    $sett[ 'custom-logo' ] = array(
                        'type' => array(
                            'field' => 'inlist',
                            'input' => 'upload'
                        ),
                        'label' => __( 'Custom Logo' , 'cannyon_' ),
                        'hint'  => __( 'Custom logo hint description', 'cannyon_' )
                    );
                    
    
    		$boxes[ 'box-1' ] = array(
                        'title' => __( 'The box Title 1' , 'cannyon_' ),
                        'sett'  => array(
                            'custom-logo'
                        )
                    );
    
    	}
    
            /* CAN BE: full, left, right */
    	$cols[ 'full' ] = array(
                'box-1'
            );
    }
    
    mythemes_cfg::set_sett( array_merge( mythemes_cfg::get_sett() , $sett ) );
    
    ?>
    

    how to use the new option:

    mythemes_options::get( 'custom-logo' );

    #3280

    mythemes
    Keymaster

    Inputs can be:

    Select

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'select'
        ),
        'values' => array(
            'val1' => __( 'Label Val 1', 'cannyon_' ),
            'val2' => __( 'Label Val 2', 'cannyon_' ),
            'val3' => __( 'Label Val 3', 'cannyon_' ),
            ...
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'Description' , 'cannyon_' )
    );
    

    Logic

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inline',
            'input' => 'logic'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Text

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'text'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Text with Multiple languages

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'text',
            'langs' => true
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    TextArea

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'textarea'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    TextArea with Multiple languages

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'textarea',
            'langs' => true
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Int ( number integer )

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'int'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Number

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'int'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Range

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'range'
        ),
        'min'   => 1,
        'max'   => 300,
        'step'  => 1,
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Percent

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'percent'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Email

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'email'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Url

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'url'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Upload

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inlist',
            'input' => 'upload'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Color

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inline',
            'input' => 'color'
        ),
        'label' => __( 'Label' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    

    Image Select

    $sett[ 'slug' ] = array(
        'type' => array(
            'field' => 'inline',
            'input' => 'image_select'
        ),
        'values' => array(
            'img1',
            'img2',
            'img3',
            'img4',
            'img5',
            'img6',
        ),
        'path'  => 'cannyon_/media/_backend/img/',
        'ext'   => 'png',
        'cols'  => 3,
        'pos'   => 'left', 
        'label' => __( 'Layout' , 'cannyon_' ),
        'hint'  => __( 'description' , 'cannyon_' )
    );
    
Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

[email protected]