示例#1
0
<?php

// currently dealing with an issue with this file loading at the appropriate time.
// will be fixed in an impending update.
/*-----------------------------------------------------------------------------------*/
/*  MEGA MENU METABOX */
/*-----------------------------------------------------------------------------------*/
if (!ts_essentials_posttype_supported('megamenu')) {
    return;
}
add_filter('cmb_meta_boxes', 'ts_megamenu_metaboxes', 506);
function ts_megamenu_metaboxes(array $meta_boxes)
{
    $prefix = '_megamenu_';
    $meta_boxes[] = array('id' => 'megamenu_metaboxes', 'title' => __('Mega Menu Settings', 'ThemeStockyard'), 'pages' => array('ts_mega_menu'), 'context' => 'normal', 'priority' => 'high', 'show_names' => true, 'fields' => array(array('name' => __('General Settings', 'ThemeStockyard'), 'desc' => '', 'type' => 'title', 'id' => $prefix . 'title_general_setting'), array('name' => __('Mega Menu link', 'ThemeStockyard'), 'desc' => __('If you want the title/label of this Mega Menu to have a link, put it here.', 'ThemeStockyard'), 'id' => $prefix . 'url', 'type' => 'text', 'std' => '#'), array('name' => __('Mega Menu Layout:', 'ThemeStockyard'), 'desc' => __('Choose a layout type (width) for this mega menu.', 'ThemeStockyard'), 'id' => $prefix . 'layout', 'type' => 'select', 'options' => array(array('name' => __('Wide', 'ThemeStockyard'), 'value' => 'wide'), array('name' => __('Standard &times; 3', 'ThemeStockyard'), 'value' => 'standardx3'), array('name' => __('Standard &times; 2', 'ThemeStockyard'), 'value' => 'standardx2'), array('name' => __('Standard', 'ThemeStockyard'), 'value' => 'standard'))), array('name' => __('Need help?', 'ThemeStockyard'), 'desc' => __('For tips and instructions on creating Mega Menus, please see our <a href="http://themestockyard.com/greyson/documentation/#!/mega_menus" target="_blank">documentation</a>.', 'ThemeStockyard'), 'type' => 'title', 'id' => $prefix . 'title_need_help')));
    return $meta_boxes;
}
示例#2
0
<?php

/*-------------------------------------------------------
Recent Portfolio widget
-------------------------------------------------------*/
if (!ts_essentials_posttype_supported('portfolio')) {
    return;
}
add_action('widgets_init', 'ts_recent_portfolio_widget');
function ts_recent_portfolio_widget()
{
    register_widget('ts_recent_portfolio_post');
}
class ts_recent_portfolio_post extends WP_Widget
{
    /* Widget setup */
    function ts_recent_portfolio_post()
    {
        /* Widget settings */
        $widget_ops = array('classname' => 'recent-portfolio-posts-widget', 'description' => __('A widget that shows recent portfolio post thumbnails', 'ThemeStockyard'));
        /* Widget control settings */
        $control_ops = array('width' => 250, 'height' => 350, 'id_base' => 'portfolio-post-recent');
        /* Create the widget */
        $this->WP_Widget('portfolio-post-recent', '(TS) ' . __('Recent Portfolio Posts', 'ThemeStockyard'), $widget_ops, $control_ops);
    }
    /* Display the widget on the screen */
    function widget($args, $instance)
    {
        $title = $instance['title'];
        $num = $instance['num'];
        echo ts_essentials_escape($args['before_widget']);