Example #1
0
function retro_cpt()
{
    $portfolios = get_pages(array('meta_key' => '_wp_page_template', 'meta_value' => 'template-portfolio.php'));
    foreach ($portfolios as $page) {
        $args = array('labels' => array('menu_name' => $page->post_title, 'name' => __('All Items', 'openframe'), 'add_new' => __('New Item', 'openframe'), 'add_new_item' => __('New Item', 'openframe'), 'edit_item' => __('Edit Item', 'openframe'), 'all_items' => __('All Items', 'openframe')), 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 20, 'query_var' => true, 'capability_type' => 'page', 'has_archive' => false, 'exclude_from_search' => true, 'supports' => array('title', 'editor', 'thumbnail', 'tags', 'post-formats', 'comments'), 'rewrite' => array('with_front' => false, 'slug' => $page->post_name), 'taxonomies' => array('tags-' . $page->ID));
        register_post_type('portfolio-' . $page->ID, $args);
        register_taxonomy('tags-' . $page->ID, 'portfolio-' . $page->ID);
    }
    if ($home = get_retro_home_page()) {
        $args = array('labels' => array('menu_name' => __('Homepage', 'openframe'), 'name' => __('All Sections', 'openframe'), 'add_new' => __('New Section', 'openframe'), 'add_new_item' => __('New Section', 'openframe'), 'edit_item' => __('Edit Section', 'openframe'), 'all_items' => __('All Sections', 'openframe')), 'publicly_queryable' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 55, 'query_var' => true, 'capability_type' => 'page', 'has_archive' => false, 'exclude_from_search' => true, 'supports' => array('title', 'editor', 'thumbnail', 'page-attributes'), 'rewrite' => false);
        register_post_type($home->post_name, $args);
    }
}
Example #2
0
<?php

require_once op_config('theme_includes') . '/metabox/wp-alchemy.php';
$metaboxes = array();
$homepage_cpt = array();
$portfolio_cpt = array();
if ($portfolios = get_retro_portfolio_pages()) {
    foreach ($portfolios as $page) {
        $portfolio_cpt[] = 'portfolio-' . $page->ID;
    }
}
if ($home = get_retro_home_page()) {
    $homepage_cpt = array($home->post_name);
    $metaboxes[] = array('id' => 'stream', 'title' => __('Section Fill', 'openframe'), 'types' => $homepage_cpt, 'lock' => WPALCHEMY_LOCK_AFTER_POST_TITLE, 'template' => op_config('theme_includes') . '/metabox/metabox-section-fill.php', 'head_action' => 'retro_metabox_javascript');
    $metaboxes[] = array('id' => 'slider', 'title' => __('Organize Slides', 'openframe'), 'types' => $homepage_cpt, 'template' => op_config('theme_includes') . '/metabox/metabox-section-slider.php', 'head_action' => 'retro_metabox_slider_javascript');
    $metaboxes[] = array('id' => 'about', 'title' => __('About Columns', 'openframe'), 'types' => $homepage_cpt, 'template' => op_config('theme_includes') . '/metabox/metabox-section-about.php', 'head_action' => 'retro_metabox_javascript');
}
$metaboxes[] = array('id' => 'link', 'title' => __('Link', 'openframe'), 'types' => array_merge($portfolio_cpt, array('post')), 'template' => op_config('theme_includes') . '/metabox/metabox-link.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'image', 'title' => __('Lightbox image', 'openframe'), 'types' => array_merge($portfolio_cpt, array('post')), 'template' => op_config('theme_includes') . '/metabox/metabox-image.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'gallery', 'title' => __('Gallery', 'openframe'), 'types' => array_merge($portfolio_cpt, array('post')), 'template' => op_config('theme_includes') . '/metabox/metabox-gallery.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'video', 'title' => __('Video', 'openframe'), 'types' => array_merge($portfolio_cpt, array('post')), 'template' => op_config('theme_includes') . '/metabox/metabox-video.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'banner', 'title' => __('Select a new image to use as banner', 'openframe'), 'types' => array_merge($homepage_cpt, array('page')), 'template' => op_config('theme_includes') . '/metabox/metabox-banner.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'headline', 'title' => __('Headline', 'openframe'), 'types' => array_merge($homepage_cpt, array('page')), 'lock' => WPALCHEMY_LOCK_AFTER_POST_TITLE, 'template' => op_config('theme_includes') . '/metabox/metabox-headline.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'welcome', 'title' => __('Welcome message', 'openframe'), 'types' => array_merge($homepage_cpt, array('page')), 'template' => op_config('theme_includes') . '/metabox/metabox-welcome.php', 'head_action' => 'retro_metabox_javascript');
$metaboxes[] = array('id' => 'layout', 'title' => __('Layout', 'openframe'), 'types' => array_merge($homepage_cpt, $portfolio_cpt, array('post', 'page')), 'lock' => WPALCHEMY_LOCK_AFTER_POST_TITLE, 'template' => op_config('theme_includes') . '/metabox/metabox-layout.php', 'head_action' => 'retro_metabox_javascript');
foreach ($metaboxes as $metabox) {
    new WPAlchemy_MetaBox($metabox);
}
function retro_metabox_javascript()
{
    wp_enqueue_script('iris');