示例#1
0
function enlightenment_select_template($args, $echo = true)
{
    $templates = enlightenment_templates();
    foreach ($templates as $name => $template) {
        $templates[$name] = $template['name'];
    }
    $defaults = array('class' => '', 'id' => '', 'options' => $templates, 'description' => '');
    $args = wp_parse_args($args, $defaults);
    $args['multiple'] = false;
    $output = enlightenment_select_box($args, false);
    if (!$echo) {
        return $output;
    }
    echo $output;
}
示例#2
0
function enlightenment_get_template($template)
{
    $templates = enlightenment_templates();
    if (array_key_exists($template, $templates)) {
        return $templates[$template];
    }
    return false;
}
function enlightenment_select_template($args, $echo = true)
{
    $templates = enlightenment_templates();
    foreach ($templates as $name => $template) {
        $templates[$name] = $template['name'];
    }
    $defaults = array('class' => '', 'id' => '', 'options' => $templates, 'description' => '');
    $args = wp_parse_args($args, $defaults);
    $args['multiple'] = false;
    $output = enlightenment_select_box($args, false);
    ob_start();
    ?>
	<script>
		jQuery(document).ready(function($) {
			$('.select-template').change(function() {
				window.location = '<?php 
    echo admin_url('themes.php?page=' . current_theme_supports('enlightenment-theme-settings', 'menu_slug') . '&tab=templates&template=');
    ?>
'+$(this).val();
			});
		});
	</script>
	<?php 
    $output .= ob_get_clean();
    if (!$echo) {
        return $output;
    }
    echo $output;
}