Esempio n. 1
0
function archive_custom_design()
{
    $tab = $_GET['tab'];
    $submenu = $_GET['submenu'];
    if ($submenu == 'archive-design') {
        ?>
		<script>
			jQuery( '.settings-submenu a' ).removeClass( 'current' );
			jQuery( '.settings-submenu a#archive-design' ).addClass( 'current' );
		</script>
		<form method="post" action="options.php">
			<?php 
        settings_fields('product_design');
        $archive_template = get_product_listing_template();
        $modern_grid_settings = get_modern_grid_settings();
        $default_classic_grid_settings = array('entries' => 3);
        $classic_grid_settings = get_option('classic_grid_settings', $default_classic_grid_settings);
        ?>
			<h2><?php 
        _e('Design Settings', 'ecommerce-product-catalog');
        ?>
</h2>
			<h3><?php 
        _e('Product Listing', 'ecommerce-product-catalog');
        ?>
</h3>
			<table class="design-table">
				<thead></thead>
				<tbody>
					<tr id="default-theme">
						<td class="with-additional-styling theme-name">
							<input type="radio" name="archive_template" value="default"<?php 
        checked('default' == $archive_template);
        ?>
><?php 
        _e('Modern Grid', 'ecommerce-product-catalog');
        ?>
</td>
						<td rowspan="2" class="theme-example"><?php 
        example_default_archive_theme();
        ?>
</td>
					</tr>
					<tr><td class="additional-styling"><strong><?php 
        _e('Additional Settings', 'ecommerce-product-catalog');
        ?>
</strong><br><input title="<?php 
        _e('Use this only with short attributes labels and values e.g. Color: Red', 'ecommerce-product-catalog');
        ?>
" type="checkbox" name="modern_grid_settings[attributes]" value="1"<?php 
        checked(1, isset($modern_grid_settings['attributes']) ? $modern_grid_settings['attributes'] : '');
        ?>
><?php 
        _e('Show Attributes', 'ecommerce-product-catalog');
        ?>
<br><?php 
        _e('Per row', 'ecommerce-product-catalog');
        ?>
: <input type="number" min="1" max="5" step="1" class="number_box" name="modern_grid_settings[per-row]" value="<?php 
        echo $modern_grid_settings['per-row'];
        ?>
"><?php 
        _e('products', 'ecommerce-product-catalog');
        ?>
</td></tr>
					<tr><td colspan="2" class="separator"></td></tr>
					<tr id="list-theme">
						<td class="with-additional-styling theme-name"><input type="radio" name="archive_template" value="list"<?php 
        checked('list' == $archive_template);
        ?>
><?php 
        _e('Classic List', 'ecommerce-product-catalog');
        ?>
</td>
						<td class="theme-example"><?php 
        example_list_archive_theme();
        ?>
</td>
					</tr>
					<tr><td colspan="2" class="separator"></td></tr>
					<tr id="grid-theme">
						<td class="with-additional-styling theme-name">
							<input type="radio" name="archive_template" value="grid"<?php 
        checked('grid' == $archive_template);
        ?>
><?php 
        _e('Classic Grid', 'ecommerce-product-catalog');
        ?>
</td>
						<td rowspan="2" class="theme-example"><?php 
        example_grid_archive_theme();
        ?>
</td>
					</tr>
					<tr>
						<td class="additional-styling"><strong><?php 
        _e('Additional Settings', 'ecommerce-product-catalog');
        ?>
</strong><br><?php 
        _e('Per row', 'ecommerce-product-catalog');
        ?>
: <input type="number" min="1" step="1" class="number_box" title="<?php 
        _e('The product listing element width will adjust accordingly to your theme content width.', 'ecommerce-product-catalog');
        ?>
" name="classic_grid_settings[entries]" value="<?php 
        echo $classic_grid_settings['entries'];
        ?>
"><?php 
        _e('products', 'ecommerce-product-catalog');
        ?>
</td>
					</tr>
					<tr><td colspan="2" class="separator"></td></tr>
					<?php 
        do_action('product_listing_theme_settings', $archive_template);
        ?>
				</tbody>
			</table>
			<p class="submit">
				<input type="submit" class="button-primary" value="<?php 
        _e('Save changes', 'ecommerce-product-catalog');
        ?>
" />
			</p>
		</form>
		<?php 
    }
}
/**
 * Adds per row class to modern grid product listing container
 *
 * @param string $class
 * @return string
 */
function add_modern_lising_class($class)
{
    $archive_template = get_product_listing_template();
    if ($archive_template == 'default') {
        $settings = get_modern_grid_settings();
        $class .= 'per-row-' . $settings['per-row'];
    }
    return $class;
}
/**
 * Returns per row setting for current product listing theme
 * @return int
 */
function get_current_per_row()
{
    $archive_template = get_product_listing_template();
    $per_row = 3;
    if ($archive_template == 'default') {
        $settings = get_modern_grid_settings();
        $per_row = $settings['per-row'];
    } else {
        if ($archive_template == 'grid') {
            $settings = get_classic_grid_settings();
            $per_row = $settings['entries'];
        }
    }
    return apply_filters('current_per_row', $per_row, $archive_template);
}
Esempio n. 4
0
/**
 * Adds per row class to modern grid product listing container
 *
 * @param string $class
 * @return string
 */
function add_modern_lising_class($class, $where = '', $archive_template = 'default')
{
    if ($archive_template == 'default') {
        $settings = get_modern_grid_settings();
        $class .= ' per-row-' . $settings['per-row'];
    }
    return $class;
}