Пример #1
0
/**
 * Register widgetized area and update sidebar with default widgets
 *
 * @since Edwards 1.0
 */
function edwards_widgets_init()
{
    register_sidebar(array('name' => __('Sidebar', wpfc_theme_name()), 'id' => 'sidebar-1', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>'));
    register_sidebar(array('name' => __('Sermon Sidebar', wpfc_theme_name()), 'id' => 'sidebar-sermon', 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h1 class="widget-title">', 'after_title' => '</h1>'));
    register_sidebar(array('name' => __('Footer', wpfc_theme_name()), 'id' => 'footer-sidebar', 'before_widget' => '<li id="%1$s" class="widget thirds %2$s">', 'after_widget' => '</li>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
}
Пример #2
0
 /**
  * Sets up theme defaults and registers support for various WordPress features.
  *
  * Note that this function is hooked into the after_setup_theme hook, which runs
  * before the init hook. The init hook is too late for some features, such as indicating
  * support post thumbnails.
  *
  * @since Edwards 1.0
  */
 function edwards_setup()
 {
     /**
      * Custom template tags for this theme.
      */
     require get_template_directory() . '/inc/template-tags.php';
     /**
      * Custom functions that act independently of the theme templates
      */
     require get_template_directory() . '/inc/extras.php';
     /**
      * Customizer additions
      */
     require get_template_directory() . '/inc/customizer.php';
     /**
      * Building meta boxes
      */
     require get_template_directory() . '/inc/meta-boxes.php';
     /**
      * Add new post types (slide, home feature)
      */
     require get_template_directory() . '/inc/post-types.php';
     /**
      * Add widget areas and custom widgets
      */
     require get_template_directory() . '/inc/widgets.php';
     /**
      * Add automatic theme updates
      */
     require get_template_directory() . '/inc/updater.php';
     /* 
      * Loads the Options Panel
      *
      * If you're loading from a child theme use stylesheet_directory
      * instead of template_directory
      */
     if (!function_exists('optionsframework_init')) {
         define('OPTIONS_FRAMEWORK_DIRECTORY', get_template_directory_uri() . '/inc/options-framework/');
         require_once dirname(__FILE__) . '/inc/options-framework/options-framework.php';
     }
     // Loads the options file for the theme customizer
     require_once dirname(__FILE__) . '/options.php';
     /**
      * Make theme available for translation
      * Translations can be filed in the /languages/ directory
      * If you're building a theme based on Edwards, use a find and replace
      * to change 'edwards' to the name of your theme in all the template files
      */
     load_theme_textdomain(wpfc_theme_name(), get_template_directory() . '/languages');
     /**
      * Add default posts and comments RSS feed links to head
      */
     add_theme_support('automatic-feed-links');
     /**
      * Enable support for Post Thumbnails; full width slider images should be 1920px by 500px
      */
     add_theme_support('post-thumbnails');
     add_image_size('content-width', 659, 345, true);
     add_image_size('featured-content-width', 659, 0, true);
     add_image_size('edwards_slide', 1600, 550, true);
     add_image_size('edwards_feature', 400, 300, true);
     add_image_size('edwards_mini', 100, 100, true);
     /**
      * This theme uses wp_nav_menu() in one location.
      */
     register_nav_menus(array('primary' => __('Primary Menu', wpfc_theme_name())));
     /**
      * Add support for the Aside Post Formats; will be enabled when WordPress 3.6 is released
      */
     //add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'audio', 'gallery' ) );
 }
Пример #3
0
<?php

/**
 * Custom functions that act independently of the theme templates
 *
 * Eventually, some of the functionality here could be replaced by core features
 *
 * @package Edwards
 * @since Edwards 1.0
 */
$prefix = 'wpfc_';
$meta_boxes = array(array('id' => 'post_meta1', 'title' => __('Video Link', wpfc_theme_name()), 'pages' => array('post', 'gallery'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Video Link', wpfc_theme_name()), 'desc' => '', 'id' => $prefix . 'video_link', 'type' => 'text', 'std' => ''))), array('id' => 'post_meta2', 'title' => __('Slider Fields', wpfc_theme_name()), 'pages' => array('post', 'gallery'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('label' => 'Slider Images', 'name' => 'Slider Images', 'desc' => 'Add images for the gallery slideshow', 'id' => $prefix . 'repeatable_test', 'type' => 'imageupload'))), array('id' => 'post_meta3', 'title' => __('Audio Link', wpfc_theme_name()), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Audio Link', wpfc_theme_name()), 'desc' => '', 'id' => $prefix . 'audio_link', 'type' => 'text', 'std' => ''))), array('id' => 'post_meta4', 'title' => __('Quote Text', wpfc_theme_name()), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Quote Text', wpfc_theme_name()), 'desc' => '', 'id' => $prefix . 'quote', 'type' => 'text', 'std' => ''), array('name' => __('Quote Author', wpfc_theme_name()), 'desc' => '', 'id' => $prefix . 'quote_author', 'type' => 'text', 'std' => ''))), array('id' => 'post_meta5', 'title' => __('Link', wpfc_theme_name()), 'pages' => array('post'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Link Url', wpfc_theme_name()), 'desc' => '', 'id' => $prefix . 'link_url', 'type' => 'text', 'std' => ''))), array('id' => 'post_meta11', 'title' => __('Page Description', wpfc_theme_name()), 'pages' => array('page'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('name' => __('Description', wpfc_theme_name()), 'desc' => 'This text appears just below the post or page title.', 'id' => $prefix . 'page_description', 'type' => 'text', 'std' => ''))));
foreach ($meta_boxes as $meta_box) {
    $my_box = new wpfc_theme_meta_box($meta_box);
}
class wpfc_theme_meta_box
{
    protected $_meta_box;
    // create meta box based on given data
    function __construct($meta_box)
    {
        $this->_meta_box = $meta_box;
        add_action('admin_menu', array(&$this, 'add'));
        add_action('save_post', array(&$this, 'save'));
    }
    /// Add meta box for multiple post types
    function add()
    {
        foreach ($this->_meta_box['pages'] as $page) {
            add_meta_box($this->_meta_box['id'], $this->_meta_box['title'], array(&$this, 'show'), $page, $this->_meta_box['context'], $this->_meta_box['priority']);
        }