Example #1
0
function xinmag_options($options)
{
    //assign default color for each section;
    $cats = xinmag_top_categories();
    foreach ($cats as $cat) {
        $color_option = 'color_' . $cat->term_id;
        if (!isset($options[$color_option])) {
            $options[$color_option] = '#888888';
        }
    }
    if (empty($options['section_order'])) {
        $colors = array('#0072BC', '#88307F', '#00AAAD', '#8DC63F', '#FAA61A', '#888888');
        $count = 0;
        $data = '';
        $css = '';
        foreach ($cats as $cat) {
            $color_option = 'color_' . $cat->term_id;
            $options[$color_option] = $colors[$count];
            $data .= 'section[]=' . $cat->term_id . '&';
            $css .= '.color_' . $cat->term_id . ' { color:' . $colors[$count] . '; } ' . "\n";
            $css .= '.bdcolor_' . $cat->term_id . ' { border-color:' . $colors[$count] . '; } ' . "\n";
            $css .= '.bgcolor_' . $cat->term_id . ' { background-color:' . $colors[$count] . '; } ' . "\n";
            $count++;
            if ($count > 5) {
                break;
            }
        }
        $options['section_order'] = $data;
        $options['xinmag_scheme_css'] = $css;
    }
    return $options;
}
Example #2
0
function xinmag_theme_options_display_page()
{
    if (!isset($_REQUEST['settings-updated'])) {
        $_REQUEST['settings-updated'] = false;
    }
    ?>
    <div class="wrap">
<?php 
    screen_icon();
    echo "<h2>" . __('Xinmag Theme Options', 'xinmag') . "</h2>";
    if (false !== $_REQUEST['settings-updated']) {
        ?>
			<div class="updated fade"><p><strong><?php 
        _e('Options Saved', 'xinmag');
        ?>
</strong></p></div>
<?php 
    }
    ?>
		<p><a class="btn btn-primary" href="<?php 
    _e('http://xinthemes.com/docs/', 'xinmag');
    ?>
" target="_blank"><strong><?php 
    _e('Documentation', 'xinmag');
    ?>
</strong></a>&nbsp;&nbsp;
		<a class="btn btn-success" href="<?php 
    _e('http://xinthemes.com/support/', 'xinmag');
    ?>
" target="_blank"><strong><?php 
    _e('Support Forum', 'xinmag');
    ?>
</strong></a>&nbsp;&nbsp;
		<a class="btn btn-info" href="<?php 
    _e('http://xinthemes.com/donate/', 'xinmag');
    ?>
" target="_blank"><strong><?php 
    _e('Donate', 'xinmag');
    ?>
</strong></a></p>
    <form method="post" action="options.php">
<?php 
    global $xinwp_theme_options, $xinwp_options;
    $xinwp_theme_options = xinmag_theme_options_array();
    $xinwp_options = xinwp_get_options();
    settings_fields('xinmag_options');
    ?>
	<div id="xin-wrapper" class="container_12">
		<input id="save-button" type="submit" class="button-primary" value="<?php 
    _e('Save Options', 'xinmag');
    ?>
" />
	<div id="xin-tabs">
		<a><?php 
    _e('Layout', 'xinmag');
    ?>
</a>
		<a><?php 
    _e('Section', 'xinmag');
    ?>
</a>
		<a><?php 
    _e('Scheme', 'xinmag');
    ?>
</a>
		<a><?php 
    _e('Fonts', 'xinmag');
    ?>
</a>
		<a><?php 
    _e('Custom CSS', 'xinmag');
    ?>
</a>
<?php 
    //Allow child them to add options.
    do_action('xinmag_options_tab_link');
    ?>
	</div>
<?php 
    /******************************************************************
    *  Theme Options related to site layout
    ******************************************************************/
    ?>
	<div class="xin-pane clearfix"><div class="grid_12">
	<h3><?php 
    _e('Site Layout (12 Columns)', 'xinmag');
    ?>
</h3>	
<?php 
    xinwp_option_display('gridwidth');
    ?>
	<div class="grid_3 alpha">
		<p><b><?php 
    _e('Content and Sidebar Width', 'xinmag');
    ?>
</b></p>
	</div>
	<div class="grid_9">
<?php 
    xinwp_option_display('content');
    xinwp_option_display('sidebar1');
    xinwp_option_display('sidebar2');
    ?>
	</div><div class="clear"></div>
<?php 
    xinwp_option_display('sidebarpos');
    xinwp_option_display('sidebarresp');
    xinwp_option_display('respbp');
    ?>
	<div class="grid_3 alpha">
		<p><b><?php 
    _e('Footer Widget Area Width', 'xinmag');
    ?>
</b></p>
	</div>
	<div class="grid_9">
<?php 
    xinwp_option_display('column_footer1');
    xinwp_option_display('column_footer2');
    xinwp_option_display('column_footer3');
    xinwp_option_display('column_footer4');
    ?>
	</div><div class="clear"></div>
		<h3><?php 
    _e('Home Page', 'xinmag');
    ?>
</h3>
<?php 
    xinwp_option_display('homepage');
    xinwp_option_display('fp_option');
    xinwp_option_display('fp_category');
    xinwp_option_display('fp_postnum');
    xinwp_option_display('fp_effect');
    ?>
		<h3><?php 
    _e('Top Bar', 'xinmag');
    ?>
</h3>
<?php 
    xinwp_option_display('brandname');
    xinwp_option_display('brandlogo');
    xinwp_option_display('brandurl');
    xinwp_option_display('menupos');
    do_action('xinmag_options_tab_layout');
    ?>
			
	</div></div>
<?php 
    /******************************************************************
    *  Theme Options: Section
    ******************************************************************/
    ?>
	<div class="xin-pane clearfix"><div class="grid_12">
	<div class="grid_6 alpha"><p><strong><?php 
    _e('Available Categories:', 'xinmag');
    ?>
</strong></p></div>
	<div class="grid_6"><p><strong><?php 
    _e('Sections on Home Page:', 'xinmag');
    ?>
</strong></p></div>
	<div class="clear"></div>
	<div class="grid_6 alpha">
	<ul id="section-available" class="section-sortable connected">	
<?php 
    $sections = array();
    parse_str($xinwp_options['section_order'], $sections);
    $cats = xinmag_top_categories();
    foreach ($cats as $cat) {
        if (empty($sections) || !in_array($cat->term_id, $sections['section'])) {
            echo '<li id="section_' . $cat->term_id . '" style="background: ';
            echo $xinwp_options['color_' . $cat->term_id] . ';" >';
            printf('<input name="xinmag_theme_options[%1$s]" type="text" value="%2$s" class="xin-color-field" />', 'color_' . $cat->term_id, esc_attr($xinwp_options['color_' . $cat->term_id]));
            echo $cat->name . '</li>';
        }
    }
    ?>
	</ul>
	<p><?php 
    _e('Use drag & drop to select the categories to be display on home page and arrange the order.', 'xinmag');
    ?>
</p>
	</div>
	<div class="grid_6">
	<ul id="section-active" class="section-sortable connected">	
<?php 
    foreach ($sections['section'] as $section) {
        echo '<li id="section_' . $section . '" style="background: ';
        echo $xinwp_options['color_' . $section] . ';" >';
        printf('<input name="xinmag_theme_options[%1$s]" type="text" value="%2$s" class="xin-color-field" />', 'color_' . $section, esc_attr($xinwp_options['color_' . $section]));
        echo get_the_category_by_ID($section) . '</li>';
    }
    ?>
	</ul>
	</div>
	<div class="clear"></div>
<?php 
    xinwp_option_display('section_postnum');
    ?>
	</div></div>
<?php 
    /******************************************************************
    *  Theme Options: Scheme
    ******************************************************************/
    ?>
	<div class="xin-pane clearfix"><div class="grid_12">
<?php 
    xinwp_option_display('colorscheme');
    ?>
		<p><?php 
    _e('Change Background Image or Color : ', 'xinmag');
    printf(__('<a href="%s">Click here</a>.', 'xinmag'), admin_url('themes.php?page=custom-background'));
    ?>
</p>
<?php 
    xinwp_option_display('headerbg');
    xinwp_option_display('titlebarbg');
    xinwp_option_display('contentbg');
    xinwp_option_display('footerbg');
    do_action('xinmag_options_tab_scheme');
    ?>
	</div></div>	
<?php 
    /**************************************
    * Theme Options - Fonts  *
    **************************************/
    ?>
	<div class="xin-pane clearfix"><div class="grid_12">
	<p><?php 
    _e('You do not need to select font for each element. For example. Body, paragraph and heading define the general fonts used. <span style="color:blue;font-weight:bold;">Please note that blue indicates webfonts (e.g Google Fonts) which may require additional load time.</span>', 'xinmag');
    ?>
</p>
<?php 
    xinwp_option_display('bodyfont');
    xinwp_option_display('headingfont');
    ?>
	<hr>
<?php 
    xinwp_option_display('sitetitlefont');
    xinwp_option_display('sitedescfont');
    ?>
	<hr>
<?php 
    xinwp_option_display('entrytitlefont');
    xinwp_option_display('widgettitlefont');
    xinwp_option_display('sidebarfont');
    xinwp_option_display('mainmenufont');
    xinwp_option_display('footerfont');
    ?>
	<h3><?php 
    _e('Additional Google Fonts', 'xinmag');
    ?>
</h3>
<?php 
    xinwp_option_display('otherfont1');
    xinwp_option_display('otherfont2');
    xinwp_option_display('otherfont3');
    xinwp_option_display('otherfont4');
    do_action('xinmag_options_tab_fonts');
    ?>
	</div></div>
<?php 
    /******************************************************************
    *  Custom CSS
    ******************************************************************/
    ?>
	<div class="xin-pane clearfix"><div class="grid_12">
<?php 
    xinwp_option_display('xinmag_inline_css');
    ?>
	</div></div>
<?php 
    /******************************************************************
    *  Child Theme Options
    ******************************************************************/
    do_action('xinmag_options_tab_page');
    xinwp_option_display('currenttab');
    xinwp_option_display('section_order');
    xinwp_option_display('schemecss');
    xinwp_option_display('xinmag_scheme_css');
    ?>
	<p><input id="save-button-bottom" type="submit" class="button-primary" value="<?php 
    _e('Save Options', 'xinmag');
    ?>
" /></p>
	</div><!-- xinmag-wrapper -->
    </form>
    </div><!-- wrap -->
<?php 
}