/**
 * This function adds new layout form elements to the user edit screen.
 * 
 * @since 1.4
 */
function genesis_user_layout_fields($user)
{
    if (!current_user_can('edit_users', $user->ID)) {
        return false;
    }
    $layout = get_the_author_meta('layout', $user->ID);
    $layout = $layout ? $layout : '';
    ?>
	
	<h3><?php 
    _e('Genesis Layout Options', 'genesis');
    ?>
</h3>
	<table class="form-table">
	
	<tr>
		<th scope="row" valign="top"><label><?php 
    _e('Choose Layout', 'genesis');
    ?>
</label></th>
		<td>
		<input type="radio" name="meta[layout]" id="default-layout" value="" <?php 
    checked('', $layout);
    ?>
 /> <label class="default" for="default-layout"><?php 
    printf(__('Default Layout set in <a href="%s">Theme Settings</a>', 'genesis'), admin_url('admin.php?page=genesis'));
    ?>
</label>
	
		<br style="clear: both;" /><br />
	
		<?php 
    foreach (genesis_get_layouts() as $id => $data) {
        printf('<label class="box"><input type="radio" name="meta[layout]" id="%s" value="%s" %s /> <img src="%s" alt="%s" /></label>', esc_attr($id), esc_attr($id), checked($id, $layout, false), esc_url($data['img']), esc_attr($data['label']));
    }
    ?>
	
		<br style="clear: both;" />
		</td>
	</tr>
	
	</table>

<?php 
}
function genesis_theme_settings_general_box()
{
    ?>
	<p><?php 
    _e("Use for blog title/logo:", 'genesis');
    ?>
	<select name="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[blog_title]">
		<option style="padding-right:10px;" value="text" <?php 
    selected('text', genesis_get_option('blog_title'));
    ?>
><?php 
    _e("Dynamic text", 'genesis');
    ?>
</option>
		<option style="padding-right:10px;" value="image" <?php 
    selected('image', genesis_get_option('blog_title'));
    ?>
><?php 
    _e("Image logo", 'genesis');
    ?>
</option>
	</select></p>			
	<p><input type="checkbox" name="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[header_right]" id="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[header_right]" value="1" <?php 
    checked(1, genesis_get_option('header_right'));
    ?>
 /> <label for="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[header_right]"><?php 
    _e("Widgetize Right Side of Header?", 'genesis');
    ?>
</label></p>
	<p><?php 
    _e("Select site layout:", 'genesis');
    ?>
	<select name="<?php 
    echo GENESIS_SETTINGS_FIELD;
    ?>
[site_layout]">
	<?php 
    foreach (genesis_get_layouts() as $id => $data) {
        printf('<option style="padding-right:10px;" value="%s" %s>%s</option>', esc_attr($id), selected($id, genesis_get_option('site_layout'), false), esc_html($data['label']));
    }
    ?>
	</select></p>
<?php 
}
Exemple #3
0
/**
 * Output the form elements necessary to select a layout.
 *
 * You must manually wrap this in an HTML element with the class of `genesis-layout-selector` in order for the CSS and
 * JavaScript to apply properly.
 *
 * Supported `$args` keys are:
 *  - name     (default is ''),
 *  - selected (default is ''),
 *  - echo     (default is true).
 *
 * The Genesis admin script is enqueued to ensure the layout selector behaviour (amending label class to add border on
 * selected layout) works.
 *
 * @since 1.7.0
 *
 * @uses genesis_get_layouts()   Get all registered layouts.
 * @uses genesis_load_admin_js() Enqueue the custom script and localizations used in the admin.
 *
 * @param array $args Optional. Function arguments. Default is empty array.
 *
 * @return string HTML markup of labels, images and radio inputs for layout selector.
 */
function genesis_layout_selector($args = array())
{
    //* Enqueue the Javascript
    genesis_load_admin_js();
    //* Merge defaults with user args
    $args = wp_parse_args($args, array('name' => '', 'selected' => '', 'type' => '', 'echo' => true));
    $output = '';
    foreach (genesis_get_layouts($args['type']) as $id => $data) {
        $class = $id == $args['selected'] ? ' selected' : '';
        $output .= sprintf('<label class="box%2$s" for="%5$s"><span class="screen-reader-text">%1$s </span><img src="%3$s" alt="%1$s" /><input type="radio" name="%4$s" id="%5$s" value="%5$s" %6$s class="screen-reader-text" /></label>', esc_attr($data['label']), esc_attr($class), esc_url($data['img']), esc_attr($args['name']), esc_attr($id), checked($id, $args['selected'], false));
    }
    //* Echo or return output
    if ($args['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
/**
 * A helper function that outputs the form elements necessary to select a layout.
 *
 * You must manually wrap this in an HTML element with the class of 'genesis-layout-selector'
 * in order for the CSS and Javascript to apply properly.
 *
 * @since 1.7
 */
function genesis_layout_selector($args = array())
{
    /** Merge defaults with user args */
    $args = wp_parse_args($args, array('name' => '', 'selected' => '', 'echo' => true));
    $output = '';
    foreach (genesis_get_layouts() as $id => $data) {
        $class = $id == $args['selected'] ? 'selected' : '';
        $output .= sprintf('<label title="%1$s" class="box %2$s"><img src="%3$s" alt="%1$s" /><br /> <input type="radio" name="%4$s" id="%5$s" value="%5$s" %6$s /></label>', esc_attr($data['label']), esc_attr($class), esc_url($data['img']), esc_attr($args['name']), esc_attr($id), checked($id, $args['selected'], false));
    }
    /** Echo or Return output */
    if ($args['echo']) {
        echo $output;
    } else {
        return $output;
    }
}
    /**
     * Render the settings metabox
     *
     * @since 0.8
     */
    function settings_box()
    {
        ?>
		<p>
			<label for="bbp_forum_layout"><?php 
        _e('Forum Layout: ', 'bbpress-genesis-extend');
        ?>
</label>
			<select name="<?php 
        echo GENESIS_SETTINGS_FIELD;
        ?>
[bbp_forum_layout]" id="bbp_forum_layout">
				<option value="genesis-default" <?php 
        selected(genesis_get_option('bbp_forum_layout'), 'genesis-default');
        ?>
><?php 
        _e('Genesis default', 'bbpress-genesis-extend');
        ?>
</option> 
				<?php 
        foreach (genesis_get_layouts() as $id => $data) {
            echo '<option value="' . esc_attr($id) . '" ' . selected(genesis_get_option('bbp_forum_layout'), esc_attr($id)) . '>' . esc_attr($data['label']) . '</option>';
        }
        ?>
			</select>
		</p>
		<p>
			<input type="checkbox" id="bbp_forum_sidebar" name="<?php 
        echo GENESIS_SETTINGS_FIELD;
        ?>
[bbp_forum_sidebar]" value="1" <?php 
        checked(genesis_get_option('bbp_forum_sidebar'));
        ?>
 />
			<label for="bbp_forum_sidebar"><?php 
        _e('Register a forum specific sidebar that will be used on all forum pages', 'bbpress-genesis-extend');
        ?>
</label>
		</p>
		<?php 
    }
/**
 * This function, hooked to display on the category/tag edit forms,
 * adds new fields for SEO. The variables $tag and $taxonomy are passed
 * via the hook so that we can use them.
 *
 * @since 1.4
 */
function genesis_taxonomy_layout_options($tag, $taxonomy)
{
    $tax = get_taxonomy($taxonomy);
    ?>
	
	<h3><?php 
    _e('Genesis Layout Options', 'genesis');
    ?>
</h3>
	<table class="form-table">
	
	<tr>
		<th scope="row" valign="top"><label><?php 
    _e('Choose Layout', 'genesis');
    ?>
</label></th>
		<td>
			<p>
			<input type="radio" name="meta[layout]" id="default-layout" value="" <?php 
    checked('', $tag->meta['layout']);
    ?>
 /> <label class="default" for="default-layout"><?php 
    printf(__('Default Layout set in <a href="%s">Theme Settings</a>', 'genesis'), admin_url('admin.php?page=genesis'));
    ?>
</label>
			</p>
			
			<p style="clear: both;">
			<?php 
    foreach (genesis_get_layouts() as $id => $data) {
        printf('<label class="box"><input type="radio" name="meta[layout]" id="%s" value="%s" %s /> <img src="%s" alt="%s" /></label>', esc_attr($id), esc_attr($id), checked($id, $tag->meta['layout'], false), esc_url($data['img']), esc_attr($data['label']));
    }
    ?>
			<br style="clear: both;" /></p>
		</td>
	</tr>
	
	</table>

<?php 
}
    function layout_styles_box()
    {
        $current = genesis_get_option('layout', $this->settings_field, false);
        ?>
		<div class="gl-section">
		  <div class="gl-desc">
			<table class="gl-layout-table">
				<tr>
				<td class="gl-label"  id="label-layout">
					<p><label for="<?php 
        echo $this->settings_field . '[layout]';
        ?>
"><?php 
        _e('Select Layout Style', 'cuttz-framework');
        ?>
</label></p>
				</td>
				<td id="layoutwidths" class="cuttz-input"><p>
				<?php 
        echo '<input type="radio" id="' . $this->settings_field . '[layout-fullwidth]" name="' . $this->settings_field . '[layout]" value="fullwidth" ' . checked($current, 'fullwidth', false) . ' />';
        echo '<label id="label-layout-fullwidth" for="' . $this->settings_field . '[layout-fullwidth]">' . __('Full-Width', 'cuttz-framework') . '</label>';
        echo '<br />';
        echo '<input type="radio" id="' . $this->settings_field . '[layout-pagewidth]" name="' . $this->settings_field . '[layout]" value="pagewidth" ' . checked($current, 'pagewidth', false) . ' />';
        echo '<label id="label-layout-pagewidth" for="' . $this->settings_field . '[layout-pagewidth]">' . __('Page-Width', 'cuttz-framework') . '</label>';
        ?>
			</p></td>
			  </tr>
			<?php 
        if (function_exists('bbpress')) {
            ?>
			<tr>
				<td colspan="2"><p class="l-desc"><strong>These settings only affect the bbPress forum pages.</strong></p></td>
				</tr>
				<tr>
				<td class="gl-label">
					<p><label for="<?php 
            echo $this->settings_field . '[bbpress-layout]';
            ?>
"><?php 
            _e('Layout For bbPress', 'cuttz-framework');
            ?>
</label></p>
				</td>
				<td class="cuttz-input"><p>
					<?php 
            $layouts = genesis_get_layouts();
            $current = genesis_get_option('bbpress-layout', $this->settings_field, false);
            echo '<select id="' . $this->settings_field . '[bbpress-layout]" name="' . $this->settings_field . '[bbpress-layout]">';
            echo '<option value="default" ' . selected($current, 'genesis-default') . '>' . __('Genesis Default', 'cuttz-framework') . '</option> ';
            foreach ($layouts as $identifier => $keys) {
                echo '<option value="' . esc_attr($identifier) . '" ' . selected($current, esc_attr($identifier)) . '>' . esc_attr($keys['label']) . '</option>';
            }
            echo '</select>';
            ?>
		  </p></td>
			  </tr>
			  <?php 
        }
        ?>

			  <tr>
				<td colspan="2">
					<h4 class="gl-head"><?php 
        _e('Layout Colors', 'cuttz-framework');
        ?>
</h4>
					<p class="l-desc"><?php 
        _e('Add some personal flair to your skin by using the controls below. You\'ll find even more controls in the other boxes in this section, so you\'ve got lots of ways to let your creativity flow!', 'cuttz-framework');
        ?>
</p></td>
			  </tr>
			  <tr>
				<td class="gl-label">
				  <p>
					<label for="<?php 
        echo $this->settings_field;
        ?>
[site-background-color]"><?php 
        _e('Body Background Color', 'cuttz-framework');
        ?>
</label>
				  </p></td>
				<td class="cuttz-input"><p>
					<input type="text" class="color_validate cuttz-color-selector" id="<?php 
        echo $this->settings_field;
        ?>
[site-background-color]" name="<?php 
        echo $this->settings_field;
        ?>
[site-background-color]" value="<?php 
        echo genesis_get_option('site-background-color', $this->settings_field, false);
        ?>
" />
				  </p></td>
			  </tr>
			  <tr>
				<td class="gl-label"><p>
					<label for="<?php 
        echo $this->settings_field;
        ?>
[page-background-color]"><?php 
        _e('Wrap Background Color', 'cuttz-framework');
        ?>
</label>
				  </p></td>
				<td class="cuttz-input"><p>
					<input type="text" class="color_validate cuttz-color-selector" id="<?php 
        echo $this->settings_field;
        ?>
[page-background-color]" name="<?php 
        echo $this->settings_field;
        ?>
[page-background-color]" value="<?php 
        echo genesis_get_option('page-background-color', $this->settings_field, false);
        ?>
" />
				  </p></td>
			  </tr>
			</table>
		</div>
		</div>
		  <?php 
    }
function genesis_inpost_layout_box()
{
    ?>

	<?php 
    wp_nonce_field(plugin_basename(__FILE__), 'genesis_inpost_layout_nonce');
    ?>
	
	<?php 
    $layout = genesis_get_custom_field('_genesis_layout');
    ?>
	
	<input type="radio" name="_genesis_layout" id="default-layout" value="" <?php 
    checked('', $layout);
    ?>
 /> <label class="default" for="default-layout"><?php 
    printf(__('Default Layout set in <a href="%s">Theme Settings</a>', 'genesis'), admin_url('admin.php?page=genesis'));
    ?>
</label>
	
	<br style="clear: both;" /><br />
	
	<?php 
    foreach (genesis_get_layouts() as $id => $data) {
        printf('<label class="box"><input type="radio" name="_genesis_layout" id="%s" value="%s" %s /> <img src="%s" alt="%s" /></label>', esc_attr($id), esc_attr($id), checked($id, $layout, false), esc_url($data['img']), esc_attr($data['label']));
    }
    ?>
	
	<br style="clear: both;" />
	
	<p><label for="genesis_custom_body_class"><b><?php 
    _e('Custom Body Class', 'genesis');
    ?>
</b></label></p>
	<p><input style="width: 99%;" type="text" name="_genesis_custom_body_class" id="genesis_custom_body_class" value="<?php 
    echo esc_attr(sanitize_html_class(genesis_get_custom_field('_genesis_custom_body_class')));
    ?>
" /></p>
	
	<p><label for="genesis_custom_post_class"><b><?php 
    _e('Custom Post Class', 'genesis');
    ?>
</b></label></p>
	<p><input style="width: 99%;" type="text" name="_genesis_custom_post_class" id="genesis_custom_post_class" value="<?php 
    echo esc_attr(sanitize_html_class(genesis_get_custom_field('_genesis_custom_post_class')));
    ?>
" /></p>
	
<?php 
}
/**
 * Does this Genesis install have the 3 column layouts deactivated?
 *
 * This function checks to see if the Genesis install still has active 3 column layouts. Since
 * child themes and plugins can deregister layouts, we need to know if they have deregistered the 3 column layouts.
 *
 * @since 0.9.2
 */
function ss_has_3_column_layouts()
{
    $_layouts = (array) genesis_get_layouts();
    $_layouts = array_keys($_layouts);
    $_3_column = array_intersect($_layouts, array('content-sidebar-sidebar', 'sidebar-content-sidebar', 'sidebar-sidebar-content'));
    return !empty($_3_column);
}
/**
 * This function returns the data from a single layout,
 * specified by the $id passed to it.
 *
 * @since 1.4
 */
function genesis_get_layout($id)
{
    $layouts = genesis_get_layouts();
    if (!$id || !isset($layouts[$id])) {
        return;
    }
    return $layouts[$id];
}
    /**
     * Render the settings metabox.
     */
    public function settings_box()
    {
        ?>
		<p>
			<label for="bbp_forum_layout"><?php 
        _e('Forum Layout: ', 'genesis-compatibility');
        ?>
</label>
			<select name="<?php 
        echo GENESIS_SETTINGS_FIELD;
        ?>
[bbp_forum_layout]" id="bbp_forum_layout">
				<option value="genesis-default" <?php 
        selected(genesis_get_option('bbp_forum_layout'), 'genesis-default');
        ?>
><?php 
        _e('Genesis default', 'genesis-compatibility');
        ?>
</option><?php 
        foreach (genesis_get_layouts() as $id => $data) {
            echo "\n\t\t\t\t";
            echo '<option value="' . esc_attr($id) . '" ' . selected(genesis_get_option('bbp_forum_layout'), esc_attr($id)) . '>' . esc_attr($data['label']) . '</option>';
        }
        ?>

			</select>
		</p>
		<p>
			<input type="checkbox" id="bbp_forum_sidebar" name="<?php 
        echo GENESIS_SETTINGS_FIELD;
        ?>
[bbp_forum_sidebar]" value="1" <?php 
        checked(genesis_get_option('bbp_forum_sidebar'));
        ?>
 />
			<label for="bbp_forum_sidebar"><?php 
        _e('Register a forum specific sidebar that will be used on all forum pages', 'genesis-compatibility');
        ?>
</label>
		</p>
		<p>
			<input type="checkbox" id="bbp_forum_desc" name="<?php 
        echo GENESIS_SETTINGS_FIELD;
        ?>
[bbp_forum_desc]" value="1" <?php 
        checked(genesis_get_option('bbp_forum_desc'));
        ?>
 />
			<label for="bbp_forum_desc"><?php 
        _e('Remove forum and topic descriptions. E.g. "This forum contains [&hellip;]" notices.', 'genesis-compatibility');
        ?>
</label>
		</p><?php 
    }