Пример #1
0
<?php

sd_register_post_type('portfolio', array('labels' => array('name' => _x('Portfolio', 'post type general name'), 'singular_name' => _x('Portfolio', 'post type singular name'), 'add_new' => _x('Add New', 'project'), 'add_new_item' => __('Add New Item'), 'edit_item' => __('Edit Item'), 'new_item' => __('New Item'), 'view_item' => __('View Item'), 'search_items' => __('Search Items'), 'not_found' => __('No items found'), 'not_found_in_trash' => __('No items found in Trash'), 'parent_item_colon' => ''), 'public' => true, 'show_ui' => true, 'hierarchical' => false, 'capability_type' => 'post', 'exclude_from_search' => false, 'show_in_nav_menus' => false, 'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'page-attributes', 'comments'), 'taxonomies' => array('projects', 'clients', 'divisions')), 'portfolio', 'portfolio_post_limits');
function register_portfolio_taxonomies()
{
    $labels = array('name' => _x('Projects', 'taxonomy general name'), 'singular_name' => _x('Project', 'taxonomy singular name'), 'search_items' => __('Search Projects'), 'all_items' => __('All Projects'), 'parent_item' => __('Parent Project'), 'parent_item_colon' => __('Parent Project:'), 'edit_item' => __('Edit Project'), 'update_item' => __('Update Project'), 'add_new_item' => __('Add New Project'), 'new_item_name' => __('New Project Name'));
    register_taxonomy('projects', 'portfolio', array('hierarchical' => true, 'labels' => $labels, 'query_var' => true, 'rewrite' => true));
    $labels = array('name' => _x('Clients', 'taxonomy general name'), 'singular_name' => _x('Client', 'taxonomy singular name'), 'search_items' => __('Search Clients'), 'all_items' => __('All Clients'), 'parent_item' => __('Parent Client'), 'parent_item_colon' => __('Parent Client:'), 'edit_item' => __('Edit Client'), 'update_item' => __('Update Client'), 'add_new_item' => __('Add New Client'), 'new_item_name' => __('New Client Name'));
    register_taxonomy('clients', 'portfolio', array('hierarchical' => true, 'labels' => $labels, 'query_var' => true, 'rewrite' => true, 'show_in_nav_menus' => false));
    $labels = array('name' => _x('Divisions', 'taxonomy general name'), 'singular_name' => _x('Division', 'taxonomy singular name'), 'search_items' => __('Search Divisions'), 'all_items' => __('All Divisions'), 'parent_item' => __('Parent Division'), 'parent_item_colon' => __('Parent Division:'), 'edit_item' => __('Edit Division'), 'update_item' => __('Update Division'), 'add_new_item' => __('Add New Division'), 'new_item_name' => __('New Division Name'));
    register_taxonomy('divisions', 'portfolio', array('hierarchical' => false, 'labels' => $labels, 'query_var' => true, 'rewrite' => true, 'show_in_nav_menus' => false));
    $labels = array('name' => _x('Galleries', 'taxonomy general name'), 'singular_name' => _x('Gallery', 'taxonomy singular name'), 'search_items' => __('Search Galleries'), 'all_items' => __('All Galleries'), 'parent_item' => __('Parent Gallery'), 'parent_item_colon' => __('Parent Gallery:'), 'edit_item' => __('Edit Gallery'), 'update_item' => __('Update Gallery'), 'add_new_item' => __('Add New Gallery'), 'new_item_name' => __('New Gallery Name'));
    register_taxonomy('gallery', array('portfolio', 'post', 'page'), array('hierarchical' => true, 'labels' => $labels, 'query_var' => true, 'rewrite' => true, 'show_in_nav_menus' => true));
}
add_action('init', 'register_portfolio_taxonomies');
function portfolio_post_limits($limit)
{
    if (is_portfolio()) {
        $old_limit = $limit;
        $limit = get_option('portfolio_rows');
        $portfolio_layout = get_option('portfolio_layout');
        switch ($portfolio_layout) {
            case 'portfolio3':
                $limit = $limit * 2;
                break;
            case 'portfolio4':
                $limit = $limit * 3;
                break;
        }
    } elseif (is_tax('gallery')) {
        $limit = get_option('gallery_limit');
Пример #2
0
function theme_slider_options()
{
    global $_theme_sliders;
    $_slider_type = get_option('slider_type');
    if ($_slider_type == 'disable' || empty($_slider_type)) {
        return;
    }
    foreach ($_theme_sliders as $slider) {
        if ($slider->id != $_slider_type) {
            continue;
        }
        $slider->options();
        break;
    }
}
sd_register_post_type('slideshow', array('labels' => array('name' => _x('Slideshow', 'post type general name'), 'singular_name' => _x('Slideshow Item', 'post type singular name'), 'add_new' => _x('Add New', 'slideshow'), 'add_new_item' => __('Add New Item'), 'edit_item' => __('Edit Item'), 'new_item' => __('New Item'), 'view_item' => __('View Item'), 'search_items' => __('Search Items'), 'not_found' => __('No items found'), 'not_found_in_trash' => __('No items found in Trash'), 'parent_item_colon' => ''), 'public' => true, 'show_ui' => true, 'hierarchical' => false, 'capability_type' => 'post', 'exclude_from_search' => true, 'show_in_nav_menus' => false, 'supports' => array('title', 'editor', 'thumbnail')), 'slideshow');
function set_slideshow_columns($columns)
{
    $columns = array('cb' => '<input type="checkbox" />', 'title' => __('Items', TEMPLATENAME), 'thumbnail' => __('Thumbnail', TEMPLATENAME));
    return $columns;
}
add_filter('manage_edit-slideshow_columns', 'set_slideshow_columns');
function display_slideshow_columns($column_name, $post_id)
{
    global $post;
    if ($post->post_type == 'slideshow') {
        if ($column_name == 'thumbnail') {
            if (has_post_thumbnail()) {
                the_post_thumbnail('thumbnail');
            } else {
                echo __('None', TEMPLATENAME);