示例#1
0
<?php

get_header();
$cb_blog_style = ot_get_option('cb_blog_style', '1');
$cb_cat_title = single_cat_title('', false);
$cb_cat_id = get_query_var('cat');
$cb_cat_desc = category_description($cb_cat_id);
$cb_cover_image_src = $cb_cover_image = NULL;
$cb_classes = 'cb-cover';
if (function_exists('get_tax_meta')) {
    $cb_blog_style = get_tax_meta($cb_cat_id, 'cb_cat_style_field_id');
    $cb_category_style = get_tax_meta($cb_cat_id, 'cb_cat_style_field_id');
    $cb_category_color_style = get_tax_meta($cb_cat_id, 'cb_cat_style_color');
    $cb_cover_image = get_tax_meta($cb_cat_id, 'cb_bg_image_field_id');
    $cb_category_ad = get_tax_meta_strip($cb_cat_id, 'cb_cat_ad');
    $cb_hp_infinite = get_tax_meta_strip($cb_cat_id, 'cb_cat_infinite');
}
if ($cb_cover_image == NULL) {
    $cb_args = array('posts_per_page' => 5, 'category' => $cb_cat_id, 'orderby' => 'rand');
    $cb_random_post = get_posts($cb_args);
    foreach ($cb_random_post as $cb_post) {
        setup_postdata($cb_post);
        $cb_post_id = $cb_post->ID;
        if (has_post_thumbnail($cb_post_id)) {
            $cb_featured_image_id = get_post_thumbnail_id($cb_post_id);
            $cb_cover_image_src = wp_get_attachment_image_src($cb_featured_image_id, 'cb-1500-320');
            $cb_cover_image = true;
            break;
        }
    }
    wp_reset_postdata();
function wp_ccp_plugin_settings_page()
{
    ?>
	<div class="wrap">
		<div id="icon-options-general" class="icon32"><br></div>
		<h2><?php 
    _e('WP Custom Category Pages', 'wp_ccp_plugin');
    ?>
</h2>
		<p><?php 
    echo sprintf(__('Plugin by: %s', 'wp_ccp_plugin'), '<a href="http://geoffkenyon.com">Geoff Kenyon</a>');
    ?>
</p>
		<?php 
    if (isset($_GET['settings-updated']) && $_GET['settings-updated']) {
        ?>
			<div class="updated">
				<p><strong><?php 
        _e('Settings updated.', 'iproperty');
        ?>
</strong></p>
			</div>
		<?php 
    }
    ?>
		<div id="wp_ccp_plugin-settings">
			<form method="post" action="options.php">
				<?php 
    settings_fields('wp_ccp_plugin_options');
    ?>
				<?php 
    do_settings_sections('wp_ccp_plugin');
    ?>
				<input name="Save" type="submit" value="<?php 
    esc_attr_e('Save settings', 'wp_ccp_plugin');
    ?>
" />
			</form>
		</div>
		<div id="wp_ccp_plugin-admin-description">
			<p>
				<?php 
    _e('To get started creating awesome category pages, simply click edit for the category that you would like to modify. There you can enter a custom headline and page title along with custom content by using the WordPress editor.', 'wp_ccp_plugin');
    ?>
			</p>
		</div>
		<div id="wp_ccp_plugin-admin-category-list-container">
			<h3><?php 
    _e('Categories', 'wp_ccp_plugin');
    ?>
</h3>
			<?php 
    $categories = get_categories(array('hide_empty' => false));
    ?>
			<?php 
    foreach ($categories as $category) {
        ?>
				<div class="wp_ccp_plugin-admin-single-category clearfix">
					<h4><?php 
        echo esc_html($category->name);
        ?>
 <a href="<?php 
        echo esc_url(admin_url('edit-tags.php?action=edit&taxonomy=category&tag_ID=' . intval($category->term_id)));
        ?>
#custom-category-pages"><?php 
        _e('edit this category', 'wp_ccp_plugin');
        ?>
</a></h4>
					<div class="wp_ccp_plugin-admin-category-details-container">
						<span class="wp_ccp_plugin-admin-category-details-label"><?php 
        _e("WPCCP enabled:", 'wp_ccp_plugin');
        ?>
</span>
						<?php 
        $enabled = get_tax_meta_strip($category->term_id, 'custom_content_enabled');
        ?>
						<span class="wp_ccp_plugin-admin-category-details-value"><?php 
        echo esc_html($enabled ? __('Yes', 'wp_ccp_plugin') : __('No', 'wp_ccp_plugin'));
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-label"><?php 
        _e("Title tag:", 'wp_ccp_plugin');
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-value"><?php 
        echo esc_html(get_tax_meta_strip($category->term_id, 'page_title'));
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-label"><?php 
        _e("Heading:", 'wp_ccp_plugin');
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-value"><?php 
        echo esc_html(get_tax_meta_strip($category->term_id, 'heading'));
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-label"><?php 
        _e("Description:", 'wp_ccp_plugin');
        ?>
</span>
						<span class="wp_ccp_plugin-admin-category-details-value"><?php 
        echo strip_tags(get_tax_meta_strip($category->term_id, 'copy'));
        ?>
</span>
					</div>
				</div>
			<?php 
    }
    ?>
		</div>
	</div>
	<?php 
}
$cb_blog_style = cb_get_blog_style();
$cb_full_site_width = $cb_grid_3 = false;
$cb_title = $cb_module_style = $cb_offset = $cb_order = $cb_orderby = $cb_filter = $cb_tag_id = $cb_post_ids = NULL;
$j = 0;
$cb_category_ad = NULL;
$cb_featured_option = 'Off';
if (is_rtl()) {
    $cb_slider_ltr_rtl = ' style="direction:ltr;"';
} else {
    $cb_slider_ltr_rtl = NULL;
}
if (function_exists('get_tax_meta')) {
    $cb_category_color_style = get_tax_meta($cb_cat_id, 'cb_cat_style_color');
    $cb_featured_option = get_tax_meta($cb_cat_id, 'cb_cat_featured_op');
    $cb_module_type = $cb_featured_option;
    $cb_category_ad = get_tax_meta_strip($cb_cat_id, 'cb_cat_ad');
}
if ($cb_featured_option == NULL) {
    $cb_featured_option = 'Off';
}
if ($cb_featured_option == 'grid-3' || $cb_featured_option == 'grid-4' || $cb_featured_option == 'grid-5' || $cb_featured_option == 'grid-6') {
    $cb_ppp = substr($cb_featured_option, -1);
    if ($cb_featured_option == 'grid-3') {
        $cb_grid_3 = true;
    }
    $cb_featured_option = 'grid-x';
}
if ($cb_featured_option == 's-2') {
    $cb_section = 'b';
} else {
    $cb_section = 'a';