本文整理汇总了PHP中woo_options_add函数的典型用法代码示例。如果您正苦于以下问题:PHP woo_options_add函数的具体用法?PHP woo_options_add怎么用?PHP woo_options_add使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了woo_options_add函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => "TimThumb - Custom Settings Panel", "desc" => "This will enable the <a href='http://code.google.com/p/timthumb/'>TimThumb</a> (thumb.php) script which dynamically resizes images added through the <strong>custom settings panel below the post</strong>. Make sure your themes <em>cache</em> folder is writable. <a href='http://www.woothemes.com/2008/10/troubleshooting-image-resizer-thumbphp/'>Need help?</a>", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Automatic Image Thumbnail", "desc" => "If no thumbnail is specifified then the first uploaded image in the post is used.", "id" => $shortname . "_auto_img", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Thumbnail Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_thumb_w', 'type' => 'text', 'std' => 100, 'meta' => 'Width'), array('id' => $shortname . '_thumb_h', 'type' => 'text', 'std' => 100, 'meta' => 'Height')));
$options[] = array("name" => "Thumbnail Alignment", "desc" => "Select how to align your thumbnails with posts.", "id" => $shortname . "_thumb_align", "std" => "alignleft", "type" => "select2", "options" => array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center"));
$options[] = array("name" => "Single Post - Show Thumbnail", "desc" => "Show the thumbnail in the single post page.", "id" => $shortname . "_thumb_single", "class" => "collapsed", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Single Post - Thumbnail Dimensions", "desc" => "Enter an integer value i.e. 250 for the image size. Max width is 576.", "id" => $shortname . "_image_dimensions", "std" => "", "class" => "hidden last", "type" => array(array('id' => $shortname . '_single_w', 'type' => 'text', 'std' => 200, 'meta' => 'Width'), array('id' => $shortname . '_single_h', 'type' => 'text', 'std' => 200, 'meta' => 'Height')));
$options[] = array("name" => "Single Post - Thumbnail Alignment", "desc" => "Select how to align your thumbnail with single posts.", "id" => $shortname . "_thumb_single_align", "std" => "alignright", "type" => "select2", "class" => "hidden", "options" => array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center"));
$options[] = array("name" => "Add thumbnail to RSS feed", "desc" => "Add the the image uploaded via your Custom Settings panel to your RSS feed", "id" => $shortname . "_rss_thumb", "std" => "false", "type" => "checkbox");
/* Footer */
$options[] = array("name" => "Footer Customization", "type" => "heading", "icon" => "footer");
$url = get_template_directory_uri() . '/functions/images/';
$options[] = array("name" => "Footer Widget Areas", "desc" => "Select how many footer widget areas you want to display.", "id" => $shortname . "_footer_sidebars", "std" => "3", "type" => "images", "options" => array('0' => $url . 'layout-off.png', '1' => $url . 'footer-widgets-1.png', '2' => $url . 'footer-widgets-2.png', '3' => $url . 'footer-widgets-3.png', '4' => $url . 'footer-widgets-4.png'));
$options[] = array("name" => "Custom Affiliate Link", "desc" => "Add an affiliate link to the WooThemes logo in the footer of the theme.", "id" => $shortname . "_footer_aff_link", "std" => "", "type" => "text");
$options[] = array("name" => "Enable Custom Footer (Left)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_left", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Left)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_left_text", "std" => "", "type" => "textarea");
$options[] = array("name" => "Enable Custom Footer (Right)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_right", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Right)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_right_text", "std" => "", "type" => "textarea");
/* Subscribe & Connect */
$options[] = array("name" => "Subscribe & Connect", "type" => "heading", "icon" => "connect");
$options[] = array("name" => "Enable Subscribe & Connect - Single Post", "desc" => "Enable the subscribe & connect area on single posts. You can also add this as a <a href='" . home_url() . "/wp-admin/widgets.php'>widget</a> in your sidebar.", "id" => $shortname . "_connect", "std" => 'false', "type" => "checkbox");
$options[] = array("name" => "Subscribe Title", "desc" => "Enter the title to show in your subscribe & connect area.", "id" => $shortname . "_connect_title", "std" => '', "type" => "text");
$options[] = array("name" => "Text", "desc" => "Change the default text in this area.", "id" => $shortname . "_connect_content", "std" => '', "type" => "textarea");
$options[] = array("name" => "Subscribe By E-mail ID (Feedburner)", "desc" => "Enter your <a href='http://www.google.com/support/feedburner/bin/answer.py?hl=en&answer=78982'>Feedburner ID</a> for the e-mail subscription form.", "id" => $shortname . "_connect_newsletter_id", "std" => '', "type" => "text");
$options[] = array("name" => 'Subscribe By E-mail to MailChimp', 'woothemes', "desc" => 'If you have a MailChimp account you can enter the <a href="http://woochimp.heroku.com" target="_blank">MailChimp List Subscribe URL</a> to allow your users to subscribe to a MailChimp List.', "id" => $shortname . "_connect_mailchimp_list_url", "std" => '', "type" => "text");
$options[] = array("name" => "Enable RSS", "desc" => "Enable the subscribe and RSS icon.", "id" => $shortname . "_connect_rss", "std" => 'true', "type" => "checkbox");
$options[] = array("name" => "Twitter URL", "desc" => "Enter your <a href='http://www.twitter.com/'>Twitter</a> URL e.g. http://www.twitter.com/woothemes", "id" => $shortname . "_connect_twitter", "std" => '', "type" => "text");
$options[] = array("name" => "Facebook URL", "desc" => "Enter your <a href='http://www.facebook.com/'>Facebook</a> URL e.g. http://www.facebook.com/woothemes", "id" => $shortname . "_connect_facebook", "std" => '', "type" => "text");
$options[] = array("name" => "YouTube URL", "desc" => "Enter your <a href='http://www.youtube.com/'>YouTube</a> URL e.g. http://www.youtube.com/woothemes", "id" => $shortname . "_connect_youtube", "std" => '', "type" => "text");
$options[] = array("name" => "Flickr URL", "desc" => "Enter your <a href='http://www.flickr.com/'>Flickr</a> URL e.g. http://www.flickr.com/woothemes", "id" => $shortname . "_connect_flickr", "std" => '', "type" => "text");
$options[] = array("name" => "LinkedIn URL", "desc" => "Enter your <a href='http://www.www.linkedin.com.com/'>LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes", "id" => $shortname . "_connect_linkedin", "std" => '', "type" => "text");
$options[] = array("name" => "Delicious URL", "desc" => "Enter your <a href='http://www.delicious.com/'>Delicious</a> URL e.g. http://www.delicious.com/woothemes", "id" => $shortname . "_connect_delicious", "std" => '', "type" => "text");
$options[] = array("name" => "Google+ URL", "desc" => "Enter your <a href='http://plus.google.com/'>Google+</a> URL e.g. https://plus.google.com/104560124403688998123/", "id" => $shortname . "_connect_googleplus", "std" => '', "type" => "text");
$options[] = array("name" => "Enable Related Posts", "desc" => "Enable related posts in the subscribe area. Uses posts with the same <strong>tags</strong> to find related posts. Note: Will not show in the Subscribe widget.", "id" => $shortname . "_connect_related", "std" => 'true', "type" => "checkbox");
/* Advertising */
//$options[] = array( "name" => "Top Ad (468x60px)",
// "type" => "heading",
// "icon" => "ads" );
//$options[] = array( "name" => "Enable Ad",
// "desc" => "Enable the ad space",
// "id" => $shortname."_ad_top",
// "std" => "false",
// "type" => "checkbox" );
//$options[] = array( "name" => "Adsense code",
// "desc" => "Enter your adsense code (or other ad network code) here.",
// "id" => $shortname."_ad_top_adsense",
// "std" => "",
// "type" => "textarea" );
//$options[] = array( "name" => "Image Location",
// "desc" => "Enter the URL to the banner ad image location.",
// "id" => $shortname."_ad_top_image",
// "std" => "http://www.woothemes.com/ads/468x60b.jpg",
// "type" => "upload" );
//$options[] = array( "name" => "Destination URL",
// "desc" => "Enter the URL where this banner ad points to.",
// "id" => $shortname."_ad_top_url",
// "std" => "http://www.woothemes.com",
// "type" => "text" );
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
$woo_metaboxes = array();
global $post;
if (get_post_type() == 'post' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload an image or enter an URL.");
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array("name" => "_image_alignment", "std" => "Center", "label" => "Image Crop Alignment", "type" => "select2", "desc" => "Select crop alignment for resized image", "options" => array("c" => "Center", "t" => "Top", "b" => "Bottom", "l" => "Left", "r" => "Right"));
}
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar)");
}
// End post
$woo_metaboxes[] = array("name" => "_layout", "std" => "normal", "label" => "Layout", "type" => "images", "desc" => "Select the layout you want on this specific post/page.", "options" => array('layout-default' => $url . 'layout-off.png', 'layout-full' => get_template_directory_uri() . '/functions/images/' . '1c.png', 'layout-left-content' => get_template_directory_uri() . '/functions/images/' . '2cl.png', 'layout-right-content' => get_template_directory_uri() . '/functions/images/' . '2cr.png'));
if (get_post_type() == 'slide' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload an image or enter an URL.");
$woo_metaboxes[] = array("name" => "slide_layout", "label" => "Slider Overlay Layout", "desc" => "Specify where you want the slider overlay content to display", "std" => "right", "type" => "select2", "options" => array("left" => "Left", "right" => "Right", "top" => "Top", "bottom" => "Bottom"));
$woo_metaboxes[] = array("name" => "slide-url", "label" => "Slide URL", "type" => "text", "desc" => "Enter a URL for the slide to click through to.");
}
// End post
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例2: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => __('Flickr URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.flickr.com/">Flickr</a> URL e.g. http://www.flickr.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_flickr", "std" => '', "type" => "text");
$options[] = array("name" => __('LinkedIn URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.www.linkedin.com.com/">LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes', 'woothemes'), "id" => $shortname . "_connect_linkedin", "std" => '', "type" => "text");
$options[] = array("name" => __('Delicious URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.delicious.com/">Delicious</a> URL e.g. http://www.delicious.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_delicious", "std" => '', "type" => "text");
$options[] = array("name" => __('Google+ URL', 'woothemes'), "desc" => __('Enter your <a href="http://plus.google.com/">Google+</a> URL e.g. https://plus.google.com/104560124403688998123/', 'woothemes'), "id" => $shortname . "_connect_googleplus", "std" => '', "type" => "text");
$options[] = array('name' => __('Dribbble', 'woothemes'), 'desc' => sprintf(__('Enter your %1$s URL e.g. http://dribbble.com/woothemes', 'woothemes'), '<a href="http://dribbble.com/">' . __('Dribbble', 'woothemes') . '</a>'), 'id' => $shortname . '_connect_dribbble', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Instagram', 'woothemes'), 'desc' => sprintf(__('Enter your %1$s URL e.g. http://instagram.com/woothemes', 'woothemes'), '<a href="http://instagram.com">' . __('Instagram', 'woothemes') . '</a>'), 'id' => $shortname . '_connect_instagram', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Vimeo', 'woothemes'), 'desc' => sprintf(__('Enter your %1$s URL e.g. http://vimeo.com/woothemes', 'woothemes'), '<a href="http://vimeo.com/">' . __('Vimeo', 'woothemes') . '</a>'), 'id' => $shortname . '_connect_vimeo', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Pinterest', 'woothemes'), 'desc' => sprintf(__('Enter your %1$s URL e.g. http://pinterest.com/woothemes', 'woothemes'), '<a href="http://pinterest.com/">' . __('Pinterest', 'woothemes') . '</a>'), 'id' => $shortname . '_connect_pinterest', 'std' => '', 'type' => 'text');
/* Contact Template Settings */
$options[] = array('name' => __('Contact Page', 'woothemes'), 'icon' => 'maps', 'type' => 'heading');
$options[] = array('name' => __('Contact Information', 'woothemes'), 'type' => 'subheading');
$options[] = array("name" => __('Contact Information Panel', 'woothemes'), "desc" => __('Enable the contact information panel on your contact page template.', 'woothemes'), "id" => $shortname . "_contact_panel", "std" => "false", "class" => 'collapsed', "type" => "checkbox");
$options[] = array('name' => __('Location Name', 'woothemes'), 'desc' => __('Enter the location name. Example: London Office', 'woothemes'), 'id' => $shortname . '_contact_title', 'std' => '', 'class' => 'hidden', 'type' => 'text');
$options[] = array('name' => __('Location Address', 'woothemes'), 'desc' => __('Enter your company\'s address', 'woothemes'), 'id' => $shortname . '_contact_address', 'std' => '', 'class' => 'hidden', 'type' => "textarea");
$options[] = array('name' => __('Telephone', 'woothemes'), 'desc' => __('Enter your telephone number', 'woothemes'), 'id' => $shortname . '_contact_number', 'std' => '', 'class' => 'hidden', 'type' => 'text');
$options[] = array('name' => __('Fax', 'woothemes'), 'desc' => __('Enter your fax number', 'woothemes'), 'id' => $shortname . '_contact_fax', 'std' => '', 'class' => 'hidden last', 'type' => 'text');
$options[] = array("name" => __('Contact Form E-Mail', 'woothemes'), "desc" => __('Enter your E-mail address to use on the "Contact Form" page Template.', 'woothemes'), "id" => $shortname . "_contactform_email", "std" => "", "type" => "text");
$options[] = array("name" => __('Enable Subscribe and Connect', 'woothemes'), "desc" => __('Enable the subscribe and connect functionality on the contact page template', 'woothemes'), "id" => $shortname . "_contact_subscribe_and_connect", "std" => "false", "type" => "checkbox");
$options[] = array('name' => __('Maps', 'woothemes'), 'type' => 'subheading');
$options[] = array('name' => __('Contact Form Google Maps Coordinates', 'woothemes'), 'desc' => sprintf(__('Enter your Google Map coordinates to display a map on the Contact Form page template. You can get these details from %sGoogle Maps%s', 'woothemes'), '<a href="' . esc_url('http://itouchmap.com/latlong.html') . '" target="_blank">', '</a>'), 'id' => $shortname . '_contactform_map_coords', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Disable Mousescroll', 'woothemes'), 'desc' => __('Turn off the mouse scroll action for all the Google Maps on the site. This could improve usability on your site.', 'woothemes'), 'id' => $shortname . '_maps_scroll', 'std' => '', 'type' => 'checkbox');
$options[] = array('name' => __('Map Height', 'woothemes'), 'desc' => __('Height in pixels for the maps displayed on Single.php pages.', 'woothemes'), 'id' => $shortname . '_maps_single_height', 'std' => "250", 'type' => 'text');
$options[] = array('name' => __('Default Map Zoom Level', 'woothemes'), 'desc' => __('Set this to adjust the default in the post & page edit backend.', 'woothemes'), 'id' => $shortname . '_maps_default_mapzoom', 'std' => "9", 'type' => 'select2', 'options' => $other_entries);
$options[] = array('name' => __('Default Map Type', 'woothemes'), 'desc' => __('Set this to the default rendered in the post backend.', 'woothemes'), 'id' => $shortname . '_maps_default_maptype', 'std' => 'G_NORMAL_MAP', 'type' => 'select2', 'options' => array('G_NORMAL_MAP' => __('Normal', 'woothemes'), 'G_SATELLITE_MAP' => __('Satellite', 'woothemes'), 'G_HYBRID_MAP' => __('Hybrid', 'woothemes'), 'G_PHYSICAL_MAP' => __('Terrain', 'woothemes')));
$options[] = array('name' => __('Map Callout Text', 'woothemes'), 'desc' => __('Text or HTML that will be output when you click on the map marker for your location.', 'woothemes'), 'id' => $shortname . '_maps_callout_text', 'std' => "", 'type' => 'textarea');
/* Projects */
if (class_exists('Projects')) {
$options[] = array('name' => __('Projects', 'woothemes'), 'type' => 'heading');
$options[] = array("name" => __('Enable Old Portfolio Look', 'woothemes'), "desc" => __('This alternative design resembles the old Portfolio layout.', 'woothemes'), "id" => $shortname . "_projects_old_look", "std" => "false", "type" => "checkbox");
$options[] = array("name" => __('Galleries Page Layout', 'woothemes'), "desc" => __('Select main content and sidebar alignment. Choose between 1, 2 or 3 column layout.', 'woothemes'), "id" => $shortname . "_projects_layout", "std" => "two-col-left", "type" => "images", "options" => array('one-col' => $images_dir . '1c.png', 'two-col-left' => $images_dir . '2cl.png', 'two-col-right' => $images_dir . '2cr.png', 'three-col-left' => $images_dir . '3cl.png', 'three-col-middle' => $images_dir . '3cm.png', 'three-col-right' => $images_dir . '3cr.png'));
$options[] = array("name" => __('Single Project Layout', 'woothemes'), "desc" => __('Select main content and sidebar alignment. Choose between 1, 2 or 3 column layout.', 'woothemes'), "id" => $shortname . "_projects_layout_single", "std" => "two-col-left", "type" => "images", "options" => array('one-col' => $images_dir . '1c.png', 'two-col-left' => $images_dir . '2cl.png', 'two-col-right' => $images_dir . '2cr.png', 'three-col-left' => $images_dir . '3cl.png', 'three-col-middle' => $images_dir . '3cm.png', 'three-col-right' => $images_dir . '3cr.png'));
}
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
$woo_metaboxes = array();
if (get_post_type() == 'post' || !get_post_type()) {
// TimThumb is enabled in options
if (get_option('woo_resize') == 'true') {
$woo_metaboxes[] = array('name' => 'image', 'label' => __('Image', 'woothemes'), 'type' => 'upload', 'desc' => __('Upload an image or enter an URL.', 'woothemes'));
$woo_metaboxes[] = array('name' => '_image_alignment', 'std' => __('Center', 'woothemes'), 'label' => __('Image Crop Alignment', 'woothemes'), 'type' => 'select2', 'desc' => __('Select crop alignment for resized image', 'woothemes'), 'options' => array('c' => 'Center', 't' => 'Top', 'b' => 'Bottom', 'l' => 'Left', 'r' => 'Right'));
}
$url = get_template_directory_uri() . '/functions/images/';
$woo_metaboxes[] = array("name" => "layout", "label" => __('Layout', 'woothemes'), "type" => "images", "desc" => __('Select a specific layout for this post/page. Overrides default site layout.', 'woothemes'), "options" => array('' => $url . 'layout-off.png', 'one-col' => $url . '1c.png', 'two-col-left' => $url . '2cl.png', 'two-col-right' => $url . '2cr.png', 'three-col-left' => $url . '3cl.png', 'three-col-middle' => $url . '3cm.png', 'three-col-right' => $url . '3cr.png'));
$woo_metaboxes[] = array("name" => "embed", "label" => __('Embed', 'woothemes'), "type" => "textarea", "desc" => __('Enter embed code for use on single posts and with the Video widget.', 'woothemes'));
if (get_option('woo_woo_tumblog_switch') == 'true') {
$woo_metaboxes[] = array("name" => "video-embed", "label" => __('Tumblog : Embed Code (Videos)', 'woothemes'), "type" => "textarea", "desc" => __('Add embed code for video services like Youtube or Vimeo - Tumblog only.', 'woothemes'));
$woo_metaboxes[] = array("name" => "quote-author", "std" => "Unknown", "label" => __('Tumblog : Quote Author', 'woothemes'), "type" => "text", "desc" => __('Enter the name of the Quote Author.', 'woothemes'));
$woo_metaboxes[] = array("name" => "quote-url", "std" => "http://", "label" => __('Tumblog : Link to Quote', 'woothemes'), "type" => "text", "desc" => __('Enter the url/web address of the Quote if available.', 'woothemes'));
$woo_metaboxes[] = array("name" => "quote-copy", "std" => "Unknown", "label" => __('Tumblog : Quote', 'woothemes'), "type" => "textarea", "desc" => __('Enter the Quote.', 'woothemes'));
$woo_metaboxes[] = array("name" => "audio", "std" => "http://", "label" => __('Tumblog : Audio URL', 'woothemes'), "type" => "text", "desc" => __('Enter the url/web address of the Audio file.', 'woothemes'));
$woo_metaboxes[] = array("name" => "link-url", "std" => "http://", "label" => __('Tumblog : Link URL', 'woothemes'), "type" => "text", "desc" => __('Enter the url/web address of the Link.', 'woothemes'));
示例3: woo_options
function woo_options()
{
// VARIABLES
$themename = "BlogTheme";
$manualurl = 'http://www.woothemes.com/support/theme-documentation/blogtheme/';
$shortname = "woo";
$GLOBALS['template_path'] = get_bloginfo('template_directory');
//Access the WordPress Categories via an Array
$woo_categories = array();
$woo_categories_obj = get_categories('hide_empty=0');
foreach ($woo_categories_obj as $woo_cat) {
$woo_categories[$woo_cat->cat_ID] = $woo_cat->cat_name;
}
$categories_tmp = array_unshift($woo_categories, "Select a category:");
//Access the WordPress Pages via an Array
$woo_pages = array();
$woo_pages_obj = get_pages('sort_column=post_parent,menu_order');
foreach ($woo_pages_obj as $woo_page) {
$woo_pages[$woo_page->ID] = $woo_page->post_name;
}
$woo_pages_tmp = array_unshift($woo_pages, "Select a page:");
//Stylesheets Reader
$alt_stylesheet_path = TEMPLATEPATH . '/styles/';
$alt_stylesheets = array();
if (is_dir($alt_stylesheet_path)) {
if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) {
while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) {
if (stristr($alt_stylesheet_file, ".css") !== false) {
$alt_stylesheets[] = $alt_stylesheet_file;
}
}
}
}
//More Options
$other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19");
// THIS IS THE DIFFERENT FIELDS
$options = array();
// THIS IS THE DIFFERENT FIELDS
$options[] = array("name" => "General Settings", "icon" => "general", "type" => "heading");
$options[] = array("name" => "Theme Stylesheet", "desc" => "Select your themes alternative color scheme.", "id" => $shortname . "_alt_stylesheet", "std" => "default.css", "type" => "select", "options" => $alt_stylesheets);
$options[] = array("name" => "Custom Logo", "desc" => "Upload a logo for your theme, or specify an image URL directly.", "id" => $shortname . "_logo", "std" => "", "type" => "upload");
$options[] = array("name" => "Custom Favicon", "desc" => "Upload a 16px x 16px <a href='http://www.faviconr.com/'>ico image</a> that will represent your website's favicon.", "id" => $shortname . "_custom_favicon", "std" => "", "type" => "upload");
$options[] = array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.", "id" => $shortname . "_google_analytics", "std" => "", "type" => "textarea");
$options[] = array("name" => "RSS URL", "desc" => "Enter your preferred RSS URL. (Feedburner or other)", "id" => $shortname . "_feedburner_url", "std" => "", "type" => "text");
$options[] = array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => $shortname . "_custom_css", "std" => "", "type" => "textarea");
$options[] = array("name" => "Twitter Username", "desc" => "Enter your Twitter Username here.", "id" => $shortname . "_twitter", "std" => "", "type" => "text");
$options[] = array("name" => "Layout Options", "icon" => "layout", "type" => "heading");
$options[] = array("name" => "Exclude pages from menu", "desc" => "Enter a comma-separated list of the <a href'http://faq.wordpress.com/2008/05/29/how-to-find-page-id-numbers/'>page ID's</a> that you'd like to exclude from the main top navigation. (ie. 1,2,3,4)", "id" => $shortname . "_menupages", "std" => "", "type" => "text");
$options[] = array("name" => "Display Full Post or Excerpt?", "desc" => "If checked, the homepage will display the full post content. If unchecked it will display the excerpt only.", "id" => $shortname . "_the_content", "std" => "false", "type" => "checkbox");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
$woo_metaboxes = array("page-description" => array("name" => "page-description", "default" => "", "label" => "Page Description", "type" => "text"));
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
/*
function woo_update_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
function woo_add_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
//add_action('switch_theme', 'woo_update_options');
if(get_option('template') == 'wooframework'){
woo_add_options();
} // end function
*/
}
示例4: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => "Link Hover Color", "desc" => "Pick a custom color for links hover or add a hex color code e.g. #697e09", "id" => "woo_link_hover_color", "std" => "", "type" => "color");
$options[] = array("name" => "Button Color", "desc" => "Pick a custom color for buttons or add a hex color code e.g. #697e09", "id" => "woo_button_color", "std" => "", "type" => "color");
$options[] = array("name" => "Home - Featured", "icon" => "featured", "type" => "heading");
$options[] = array("name" => "Disable Featured Area", "desc" => "Check this if you don't want to use the featured area.", "id" => $shortname . "_featured_disable", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Featured Image Bottom Margin", "desc" => "Enter a custom bottom margin for the featured image e.g -65 or 20", "id" => $shortname . "_featured_image_margin", "std" => "-65", "type" => "text");
$options[] = array("name" => "Featured Fade Speed", "desc" => "Enter a time in milliseconds for the fade transition e.g. 500", "id" => $shortname . "_featured_speed", "std" => "500", "type" => "text");
$options[] = array("name" => "Featured Timeout", "desc" => "Enter a time in milliseconds to wait between page transitions e.g. 6000. Set to 0 to disable auto fade.", "id" => $shortname . "_featured_timeout", "std" => "6000", "type" => "text");
$options[] = array("name" => "Featured Auto Resize", "desc" => "Enable automatic resizing of the featured area with animation to fit the featured page content.", "id" => $shortname . "_featured_resize", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Height", "desc" => "Change the default featured height from 325px to your own preferred height. <strong>Example: '300'</strong>.", "id" => $shortname . "_featured_height", "std" => "", "type" => "text");
$options[] = array("name" => "Home - Main Area", "icon" => "homepage", "type" => "heading");
$options[] = array("name" => "Mini-Features Area", "desc" => "Enable the front page Mini-Features features area.", "id" => $shortname . "_main_pages", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Mini-Features More Link URL", "desc" => "Enter a URL for the more features link under mini-features.", "id" => $shortname . "_main_pages_link", "std" => "", "type" => "text");
$options[] = array("name" => "Mini-Features More Link Text", "desc" => "Enter a text for the more features link under mini-features.", "id" => $shortname . "_main_pages_link_text", "std" => "View all features", "type" => "text");
$options[] = array("name" => "Custom permalink", "desc" => "This option allows you to change the permalink on the individual mini-features pages. (e.g /infobox/pagename to /features/pagename/). Please update <a href='" . admin_url('options-permalink.php') . "'>Permalinks</a> after any changes.", "id" => $shortname . "_infobox_rewrite", "std" => "infobox", "type" => "text");
$options[] = array("name" => "Homepage content #1", "desc" => "(Optional) Select a page that you'd like to display on the front page <strong>above the mini features area</strong>.", "id" => $shortname . "_main_page1", "std" => "Select a page:", "type" => "select", "options" => $woo_pages);
$options[] = array("name" => "Homepage content #2", "desc" => "(Optional) Select a page that you'd like to display on the front page <strong>below the mini features area.</strong>", "id" => $shortname . "_main_page2", "std" => "Select a page:", "type" => "select", "options" => $woo_pages);
$options[] = array("name" => "Portfolio", "icon" => "portfolio", "type" => "heading");
$options[] = array("name" => "Use Lightbox?", "desc" => "Show the portfolio URL or large image in a javascript lightbox.", "id" => $shortname . "_portfolio_lightbox", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Use Dynamic Image Resizer?", "desc" => "Use the dynamic image resizer (thumb.php) to resize the portfolio thumbnail. Remember to CHMOD your cache folder to 777. <a href='http://www.woothemes.com/2008/10/troubleshooting-image-resizer-thumbphp/'>Need help?</a>", "id" => $shortname . "_portfolio_resize", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Portfolio Tags", "desc" => "Enter comma seperated tags for portfolio sorting (e.g. web, print, icons). You must add these tags to the portfolio items you want to sort.", "id" => $shortname . "_portfolio_tags", "std" => "", "type" => "text");
$options[] = array("name" => "Layout Options", "icon" => "layout", "type" => "heading");
$options[] = array("name" => "Show Breadcrumbs bar?", "desc" => "Check this box if you'd like to show breadcrumbs at the top of your pages, posts and archives. <a href='http://yoast.com/wordpress/breadcrumbs/'>Yoast Breadcrumbs Plugin</a> is supported in the breadcrumbs bar.", "id" => $shortname . "_breadcrumbs", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Blog Excerpt", "desc" => "Show only the excerpt in the blog section. ", "id" => $shortname . "_excerpt", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Dynamic Images", "type" => "heading", "icon" => "image");
$options[] = array("name" => "Enable WordPress Post Thumbnail Support", "desc" => "Use WordPress post thumbnail support to assign a post thumbnail.", "id" => $shortname . "_post_image_support", "std" => "true", "class" => "collapsed", "type" => "checkbox");
$options[] = array("name" => "Dynamically Resize Post Thumbnail", "desc" => "The post thumbnail will be dynamically resized using native WP resize functionality. <em>(Requires PHP 5.2+)</em>", "id" => $shortname . "_pis_resize", "std" => "true", "class" => "hidden", "type" => "checkbox");
$options[] = array("name" => "Hard Crop Post Thumbnail", "desc" => "The image will be cropped to match the target aspect ratio.", "id" => $shortname . "_pis_hard_crop", "std" => "true", "class" => "hidden last", "type" => "checkbox");
$options[] = array("name" => "Enable Dynamic Image Resizer", "desc" => "This will enable the thumb.php script which dynamically resizes images on your site.", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Automatic Image Thumbs", "desc" => "If no image is specified in the 'image' custom field then the first uploaded post image is used.", "id" => $shortname . "_auto_img", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Thumbnail Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_thumb_w', 'type' => 'text', 'std' => 100, 'meta' => 'Width'), array('id' => $shortname . '_thumb_h', 'type' => 'text', 'std' => 100, 'meta' => 'Height')));
$options[] = array("name" => "Thumbnail Image alignment", "desc" => "Select how to align your thumbnails with posts.", "id" => $shortname . "_thumb_align", "std" => "alignleft", "type" => "radio", "options" => $options_thumb_align);
$options[] = array("name" => "Show thumbnail in Single Posts", "desc" => "Show the attached image in the single post page.", "id" => $shortname . "_thumb_single", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Single Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the image size. Max width is 576.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_single_w', 'type' => 'text', 'std' => 200, 'meta' => 'Width'), array('id' => $shortname . '_single_h', 'type' => 'text', 'std' => 200, 'meta' => 'Height')));
$options[] = array("name" => "Add thumbnail to RSS feed", "desc" => "Add the the image uploaded via your Custom Settings to your RSS feed", "id" => $shortname . "_rss_thumb", "std" => "false", "type" => "checkbox");
//Footer
$options[] = array("name" => "Footer Customization", "icon" => "footer", "type" => "heading");
$options[] = array("name" => "Custom Affiliate Link", "desc" => "Add an affiliate link to the WooThemes logo in the footer of the theme.", "id" => $shortname . "_footer_aff_link", "std" => "", "type" => "text");
$options[] = array("name" => "Enable Custom Footer (Left)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_left", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Left)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_left_text", "std" => "<p></p>", "type" => "textarea");
$options[] = array("name" => "Enable Custom Footer (Right)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_right", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Right)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_right_text", "std" => "<p></p>", "type" => "textarea");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
$woo_metaboxes = array();
if (get_post_type() == 'post' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload image for use with blog posts");
}
// End post
if (get_post_type() == 'slide' || !get_post_type()) {
$woo_metaboxes["slide_image"] = array("name" => "slide_image", "label" => "Slider Image", "type" => "upload", "desc" => "Upload image for use in the featured area on the homepage");
$woo_metaboxes["slide_url"] = array("name" => "slide_url", "label" => "Slider Link out", "type" => "text", "desc" => "Enter a custom URL for the featured image on homepage");
$woo_metaboxes["slide_embed"] = array("name" => "slide_embed", "label" => "Slider Embed Code", "type" => "textarea", "desc" => "Enter a video embed code to use in featured area.");
}
// End slide
if (get_post_type() == 'infobox' || !get_post_type()) {
$woo_metaboxes['mini'] = array("name" => "mini", "label" => "Mini-features Icon", "type" => "upload", "desc" => "Upload icon for use with the Mini-Feature on the homepage (optimal size: 32x32px) (optional)");
$woo_metaboxes['mini_excerpt'] = array("name" => "mini_excerpt", "label" => "Mini-features Excerpt", "type" => "textarea", "desc" => "Enter the text to show in your Mini-Feature. ");
$woo_metaboxes['mini_readmore'] = array("name" => "mini_readmore", "std" => "", "label" => "Mini-features URL", "type" => "text", "desc" => "Add an URL for your Read More button in your Mini-Feature on homepage (optional)");
}
// End mini
if (get_post_type() == 'portfolio' || !get_post_type()) {
$woo_metaboxes['portfolio'] = array("name" => "portfolio", "label" => "Portfolio Thumbnail", "type" => "upload", "desc" => "Upload an image for use in the portfolio (optimal size: 450x210)");
$woo_metaboxes['portfolio-large'] = array("name" => "portfolio-large", "label" => "Portfolio Large", "type" => "upload", "desc" => "Add an URL OR upload an image for use as the large portfolio image");
}
// End portfolio
if (get_post_type() == 'feedback' || !get_post_type()) {
$woo_metaboxes['feedback_citation'] = array("name" => "feedback_citation", "label" => "Citation", "type" => "text", "desc" => "Enter a citation for this feedback post.");
}
// End portfolio
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例5: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => "Custom Text (Right)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_right_text", "std" => "", "type" => "textarea");
/* Subscribe & Connect */
$options[] = array("name" => "Subscribe & Connect", "type" => "heading", "icon" => "connect");
$options[] = array("name" => "Enable Subscribe & Connect - Single Post", "desc" => "Enable the subscribe & connect area on single posts. You can also add this as a <a href='" . home_url() . "/nxt-admin/widgets.php'>widget</a> in your sidebar.", "id" => $shortname . "_connect", "std" => 'false', "type" => "checkbox");
$options[] = array("name" => "Subscribe Title", "desc" => "Enter the title to show in your subscribe & connect area.", "id" => $shortname . "_connect_title", "std" => '', "type" => "text");
$options[] = array("name" => "Text", "desc" => "Change the default text in this area.", "id" => $shortname . "_connect_content", "std" => '', "type" => "textarea");
$options[] = array("name" => "Subscribe By E-mail ID (Feedburner)", "desc" => "Enter your <a href='http://www.google.com/support/feedburner/bin/answer.py?hl=en&answer=78982'>Feedburner ID</a> for the e-mail subscription form.", "id" => $shortname . "_connect_newsletter_id", "std" => '', "type" => "text");
$options[] = array("name" => 'Subscribe By E-mail to MailChimp', 'woothemes', "desc" => 'If you have a MailChimp account you can enter the <a href="http://woochimp.heroku.com" target="_blank">MailChimp List Subscribe URL</a> to allow your users to subscribe to a MailChimp List.', "id" => $shortname . "_connect_mailchimp_list_url", "std" => '', "type" => "text");
$options[] = array("name" => "Enable RSS", "desc" => "Enable the subscribe and RSS icon.", "id" => $shortname . "_connect_rss", "std" => 'true', "type" => "checkbox");
$options[] = array("name" => "Twitter URL", "desc" => "Enter your <a href='http://www.twitter.com/'>Twitter</a> URL e.g. http://www.twitter.com/woothemes", "id" => $shortname . "_connect_twitter", "std" => '', "type" => "text");
$options[] = array("name" => "Facebook URL", "desc" => "Enter your <a href='http://www.facebook.com/'>Facebook</a> URL e.g. http://www.facebook.com/woothemes", "id" => $shortname . "_connect_facebook", "std" => '', "type" => "text");
$options[] = array("name" => "YouTube URL", "desc" => "Enter your <a href='http://www.youtube.com/'>YouTube</a> URL e.g. http://www.youtube.com/woothemes", "id" => $shortname . "_connect_youtube", "std" => '', "type" => "text");
$options[] = array("name" => "Flickr URL", "desc" => "Enter your <a href='http://www.flickr.com/'>Flickr</a> URL e.g. http://www.flickr.com/woothemes", "id" => $shortname . "_connect_flickr", "std" => '', "type" => "text");
$options[] = array("name" => "LinkedIn URL", "desc" => "Enter your <a href='http://www.www.linkedin.com.com/'>LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes", "id" => $shortname . "_connect_linkedin", "std" => '', "type" => "text");
$options[] = array("name" => "Delicious URL", "desc" => "Enter your <a href='http://www.delicious.com/'>Delicious</a> URL e.g. http://www.delicious.com/woothemes", "id" => $shortname . "_connect_delicious", "std" => '', "type" => "text");
$options[] = array("name" => "Google+ URL", "desc" => "Enter your <a href='http://plus.google.com/'>Google+</a> URL e.g. https://plus.google.com/104560124403688998123/", "id" => $shortname . "_connect_googleplus", "std" => '', "type" => "text");
$options[] = array("name" => "Enable Related Posts", "desc" => "Enable related posts in the subscribe area. Uses posts with the same <strong>tags</strong> to find related posts. Note: Will not show in the Subscribe widget.", "id" => $shortname . "_connect_related", "std" => 'true', "type" => "checkbox");
/* Advertising */
$options[] = array("name" => "Advertising", "type" => "heading", "icon" => "ads");
$options[] = array("name" => "Top Ad (468x60px)", "type" => "subheading");
$options[] = array("name" => "Enable Ad", "desc" => "Enable the ad space", "id" => $shortname . "_ad_top", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Adsense code", "desc" => "Enter your adsense code (or other ad network code) here.", "id" => $shortname . "_ad_top_adsense", "std" => "", "type" => "textarea");
$options[] = array("name" => "Image Location", "desc" => "Enter the URL to the banner ad image location.", "id" => $shortname . "_ad_top_image", "std" => "http://www.woothemes.com/ads/468x60b.jpg", "type" => "upload");
$options[] = array("name" => "Destination URL", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_top_url", "std" => "http://www.woothemes.com", "type" => "text");
/* Contact Template Settings */
$options[] = array('name' => "Contact Page", 'icon' => 'maps', 'type' => 'heading');
$options[] = array('name' => "Contact Information", 'type' => 'subheading');
$options[] = array("name" => "Enable Contact Information Panel", "desc" => "Enable the contact informal panel", "id" => $shortname . "_contact_panel", "std" => "false", "class" => 'collapsed', "type" => "checkbox");
$options[] = array('name' => "Location Name", 'desc' => "Enter the location name. Example: London Office", 'id' => $shortname . '_contact_title', 'std' => '', "class" => 'hidden', 'type' => 'text');
$options[] = array('name' => "Location Address", 'desc' => "Enter your company's address", 'id' => $shortname . '_contact_address', 'std' => '', "class" => 'hidden', 'type' => "textarea");
$options[] = array('name' => "Telephone", 'desc' => "Enter your telephone number", 'id' => $shortname . '_contact_number', 'std' => '', "class" => 'hidden', 'type' => 'text');
$options[] = array('name' => "Fax", 'desc' => "Enter your fax number", 'id' => $shortname . '_contact_fax', 'std' => '', "class" => 'hidden last', 'type' => 'text');
$options[] = array("name" => "Contact Form E-Mail", "desc" => "Enter your E-mail address to use on the 'Contact Form' page Template.", "id" => $shortname . "_contactform_email", "std" => "", "type" => "text");
$options[] = array('name' => "Your Twitter username", 'desc' => "Enter your Twitter username. Example: woothemes", 'id' => $shortname . '_contact_twitter', 'std' => '', 'type' => 'text');
$options[] = array("name" => "Enable Subscribe and Connect", "desc" => "Enable the subscribe and connect functionality on the contact page template", "id" => $shortname . "_contact_subscribe_and_connect", "std" => "false", "type" => "checkbox");
$options[] = array('name' => "Maps", 'type' => 'subheading');
$options[] = array('name' => "Contact Form Google Maps Coordinates", 'desc' => 'Enter your Google Map coordinates to display a map on the Contact Form page template and a link to it on the Contact Us widget. You can get these details from <a href="http://www.getlatlon.com/" target="_blank">Google Maps</a>', 'id' => $shortname . '_contactform_map_coords', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Disable Mousescroll", 'desc' => "Turn off the mouse scroll action for all the Google Maps on the site. This could improve usability on your site.", 'id' => $shortname . '_maps_scroll', 'std' => '', 'type' => 'checkbox');
$options[] = array('name' => "Map Height", 'desc' => "Height in pixels for the maps displayed on Single.php pages.", 'id' => $shortname . '_maps_single_height', 'std' => "250", 'type' => 'text');
$options[] = array('name' => "Default Map Zoom Level", 'desc' => "Set this to adjust the default in the post & page edit backend.", 'id' => $shortname . '_maps_default_mapzoom', 'std' => "9", 'type' => 'select2', 'options' => $other_entries);
$options[] = array('name' => "Default Map Type", 'desc' => "Set this to the default rendered in the post backend.", 'id' => $shortname . '_maps_default_maptype', 'std' => 'G_NORMAL_MAP', 'type' => 'select2', 'options' => array('G_NORMAL_MAP' => 'Normal', 'G_SATELLITE_MAP' => 'Satellite', 'G_HYBRID_MAP' => 'Hybrid', 'G_PHYSICAL_MAP' => 'Terrain'));
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
global $post;
$woo_metaboxes = array();
// Shown on both posts and pages
// Show only on specific post types or page
if (get_post_type() == 'post' || get_post_type() == 'slide' || !get_post_type()) {
// TimThumb is enabled in options
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload an image or enter an URL.");
$woo_metaboxes[] = array("name" => "_image_alignment", "std" => "Center", "label" => "Image Crop Alignment", "type" => "select2", "desc" => "Select crop alignment for resized image", "options" => array("c" => "Center", "t" => "Top", "b" => "Bottom", "l" => "Left", "r" => "Right"));
// TimThumb disabled in the options
} else {
$woo_metaboxes[] = array("name" => "_timthumb-info", "label" => "Image", "type" => "info", "desc" => "<strong>TimThumb</strong> is disabled. Use the <strong>Featured Image</strong> panel in the sidebar instead, or enable TimThumb in the options panel.");
}
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar)");
} elseif (get_post_type() == 'portfolio' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => __("Embed Code", 'woothemes'), "type" => "textarea", "desc" => __("Enter the video embed code for your video (YouTube, Vimeo or similar)", 'woothemes'));
$woo_metaboxes[] = array("name" => "_portfolio_url", "std" => "", "label" => "Portfolio URL", "type" => "text", "desc" => "Enter an alternative URL for your Portfolio item. By default it will link to your portfolio post or lightbox.");
}
// End portfolio
if (get_post_type() == 'slide' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "url", "label" => "Slide URL", "type" => "text", "desc" => "Enter an URL to link the slider title and image to a page e.g. http://yoursite.com/pagename/ (optional) ");
}
// End Slide
if (get_post_type() == 'features' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "feature_icon", "label" => "Features Icon", "type" => "upload", "desc" => "Upload icon for use with the Feature ara on the homepage (optimal size: 32x32px) (optional)");
$woo_metaboxes[] = array("name" => "feature_excerpt", "label" => "Features Excerpt", "type" => "textarea", "desc" => "Enter the text to show in your Feature on your homepage. If nothing is specified, an excerpt of your post will be output.");
$woo_metaboxes[] = array("name" => "feature_readmore", "std" => "", "label" => "Features URL", "type" => "text", "desc" => "Add an alternative URL for your Feature title link. By default it will link to your feature post.");
}
// End mini
if (get_post_type() == 'post' || get_post_type() == 'page' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "_layout", "std" => "normal", "label" => "Layout", "type" => "images", "desc" => "Select the layout you want on this specific post/page.", "options" => array('layout-default' => $url . 'layout-off.png', 'layout-full' => get_template_directory_uri() . '/functions/images/' . '1c.png', 'layout-left-content' => get_template_directory_uri() . '/functions/images/' . '2cl.png', 'layout-right-content' => get_template_directory_uri() . '/functions/images/' . '2cr.png'));
}
// End post & page
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例6: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => "Calendar As Thumb", "desc" => "This will enable a calendar icon instead a post image thumb", "id" => $shortname . "_post_calendar", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "WP Post Thumbnail", "desc" => "Use WordPress post thumbnail to assign a post thumbnail.", "id" => $shortname . "_post_image_support", "std" => "true", "class" => "collapsed", "type" => "checkbox");
$options[] = array("name" => "WP Post Thumbnail - Dynamically Resize", "desc" => "The post thumbnail will be dynamically resized using native WP resize functionality. <em>(Requires PHP 5.2+)</em>", "id" => $shortname . "_pis_resize", "std" => "true", "class" => "hidden", "type" => "checkbox");
$options[] = array("name" => "WP Post Thumbnail - Hard Crop", "desc" => "The image will be cropped to match the target aspect ratio.", "id" => $shortname . "_pis_hard_crop", "std" => "true", "class" => "hidden last", "type" => "checkbox");
$options[] = array("name" => "Enable Dynamic Image Resizer", "desc" => "This will enable the thumb.php script which dynamically resizes images added through post custom field.", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Automatic Image Thumbs", "desc" => "If no image is specified in the 'image' custom field or WP post thumbnail then the first uploaded post image is used.", "id" => $shortname . "_auto_img", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Thumbnail Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_thumb_w', 'type' => 'text', 'std' => 100, 'meta' => 'Width'), array('id' => $shortname . '_thumb_h', 'type' => 'text', 'std' => 100, 'meta' => 'Height')));
$options[] = array("name" => "Thumbnail Image alignment", "desc" => "Select how to align your thumbnails with posts.", "id" => $shortname . "_thumb_align", "std" => "alignleft", "type" => "radio", "options" => array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center"));
$options[] = array("name" => "Show thumbnail in Single Posts", "desc" => "Show the attached image in the single post page.", "id" => $shortname . "_thumb_single", "class" => "collapsed", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Single Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the image size. Max width is 576.", "id" => $shortname . "_image_dimensions", "std" => "", "class" => "hidden last", "type" => array(array('id' => $shortname . '_single_w', 'type' => 'text', 'std' => 570, 'meta' => 'Width'), array('id' => $shortname . '_single_h', 'type' => 'text', 'std' => 170, 'meta' => 'Height')));
$options[] = array("name" => "Single Post Image alignment", "desc" => "Select how to align your thumbnail with single posts.", "id" => $shortname . "_thumb_single_align", "std" => "aligncenter", "type" => "radio", "class" => "hidden", "options" => array("alignleft" => "Left", "alignright" => "Right", "aligncenter" => "Center"));
$options[] = array("name" => "Add thumbnail to RSS feed", "desc" => "Add the the image uploaded via your Custom Settings to your RSS feed", "id" => $shortname . "_rss_thumb", "std" => "false", "type" => "checkbox");
/* Footer */
$options[] = array("name" => "Footer Customization", "type" => "heading", "icon" => "footer");
$url = get_bloginfo('template_url') . '/functions/images/';
$options[] = array("name" => "Footer Widget Areas", "desc" => "Select how many footer widget areas you want to display.", "id" => $shortname . "_footer_sidebars", "std" => "4", "type" => "images", "options" => array('0' => $url . 'layout-off.png', '1' => $url . 'footer-widgets-1.png', '2' => $url . 'footer-widgets-2.png', '3' => $url . 'footer-widgets-3.png', '4' => $url . 'footer-widgets-4.png'));
$options[] = array("name" => "Custom Affiliate Link", "desc" => "Add an affiliate link to the WooThemes logo in the footer of the theme.", "id" => $shortname . "_footer_aff_link", "std" => "", "type" => "text");
$options[] = array("name" => "Enable Custom Footer (Left)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_left", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Left)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_left_text", "std" => "", "type" => "textarea");
$options[] = array("name" => "Enable Custom Footer (Right)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_right", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Right)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_right_text", "std" => "", "type" => "textarea");
/* Subscribe & Connect */
$options[] = array("name" => "Subscribe & Connect", "type" => "heading", "icon" => "connect");
$options[] = array("name" => "Enable Subscribe & Connect - Single Post", "desc" => "Enable the subscribe & connect area on single posts. You can also add this as a <a href='" . home_url() . "/wp-admin/widgets.php'>widget</a> in your sidebar.", "id" => $shortname . "_connect", "std" => 'false', "type" => "checkbox");
$options[] = array("name" => "Subscribe Title", "desc" => "Enter the title to show in your subscribe & connect area.", "id" => $shortname . "_connect_title", "std" => '', "type" => "text");
$options[] = array("name" => "Text", "desc" => "Change the default text in this area.", "id" => $shortname . "_connect_content", "std" => '', "type" => "textarea");
$options[] = array("name" => "Subscribe By E-mail ID (Feedburner)", "desc" => "Enter your <a href='http://www.google.com/support/feedburner/bin/answer.py?hl=en&answer=78982'>Feedburner ID</a> for the e-mail subscription form.", "id" => $shortname . "_connect_newsletter_id", "std" => '', "type" => "text");
$options[] = array("name" => "Enable RSS", "desc" => "Enable the subscribe and RSS icon.", "id" => $shortname . "_connect_rss", "std" => 'true', "type" => "checkbox");
$options[] = array("name" => "Twitter URL", "desc" => "Enter your <a href='http://www.twitter.com/'>Twitter</a> URL e.g. http://www.twitter.com/woothemes", "id" => $shortname . "_connect_twitter", "std" => '', "type" => "text");
$options[] = array("name" => "Facebook URL", "desc" => "Enter your <a href='http://www.facebook.com/'>Facebook</a> URL e.g. http://www.facebook.com/woothemes", "id" => $shortname . "_connect_facebook", "std" => '', "type" => "text");
$options[] = array("name" => "YouTube URL", "desc" => "Enter your <a href='http://www.youtube.com/'>YouTube</a> URL e.g. http://www.youtube.com/woothemes", "id" => $shortname . "_connect_youtube", "std" => '', "type" => "text");
$options[] = array("name" => "Flickr URL", "desc" => "Enter your <a href='http://www.flickr.com/'>Flickr</a> URL e.g. http://www.flickr.com/woothemes", "id" => $shortname . "_connect_flickr", "std" => '', "type" => "text");
$options[] = array("name" => "LinkedIn URL", "desc" => "Enter your <a href='http://www.www.linkedin.com.com/'>LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes", "id" => $shortname . "_connect_linkedin", "std" => '', "type" => "text");
$options[] = array("name" => "Delicious URL", "desc" => "Enter your <a href='http://www.delicious.com/'>Delicious</a> URL e.g. http://www.delicious.com/woothemes", "id" => $shortname . "_connect_delicious", "std" => '', "type" => "text");
$options[] = array("name" => "Enable Related Posts", "desc" => "Enable related posts in the subscribe area. Uses posts with the same <strong>tags</strong> to find related posts. Note: Will not show in the Subscribe widget.", "id" => $shortname . "_connect_related", "std" => 'true', "type" => "checkbox");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
$woo_metaboxes = array();
global $post;
if (get_post_type() == 'post' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload an image or enter an URL.");
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array("name" => "_image_alignment", "std" => "Center", "label" => "Image Crop Alignment", "type" => "select2", "desc" => "Select crop alignment for resized image", "options" => array("c" => "Center", "t" => "Top", "b" => "Bottom", "l" => "Left", "r" => "Right"));
}
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar)");
}
// End post
if (get_post_type() == 'page' || get_post_type() == 'post' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "_layout", "std" => "normal", "label" => "Layout", "type" => "images", "desc" => "Select the layout you want on this specific post/page.", "options" => array('layout-default' => $url . 'layout-off.png', 'layout-full' => get_bloginfo('template_url') . '/functions/images/' . '1c.png', 'layout-left-content' => get_bloginfo('template_url') . '/functions/images/' . '2cl.png', 'layout-right-content' => get_bloginfo('template_url') . '/functions/images/' . '2cr.png'));
}
if (get_post_type() == 'slide' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Slide Image", "type" => "upload", "desc" => "Upload an image or enter an URL to your slide image");
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Video Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar). Will show instead of your image.");
$woo_metaboxes[] = array("name" => "url", "label" => "URL", "type" => "text", "desc" => "Enter URL if you want to add a link to the uploaded image and title. (optional) ");
}
//End slide
if (get_post_type() == 'infobox' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "mini", "label" => "Mini-features Icon", "type" => "upload", "desc" => "Upload icon for use with the Mini-Feature on the homepage (optimal size: 32x32px) (optional)");
$woo_metaboxes[] = array("name" => "mini_excerpt", "label" => "Mini-features Excerpt", "type" => "textarea", "desc" => "Enter the text to show in your Mini-Feature. ");
$woo_metaboxes[] = array("name" => "mini_readmore", "std" => "", "label" => "Mini-features URL", "type" => "text", "desc" => "Add an URL for your Read More button in your Mini-Feature on homepage (optional)");
}
// End mini
if (get_post_type() == 'feedback' || !get_post_type()) {
$woo_metaboxes['feedback_author'] = array("name" => "feedback_author", "label" => "Feedback Author", "type" => "text", "desc" => "Enter the name of the author of the feedback e.g. Joe Bloggs");
$woo_metaboxes['feedback_url'] = array("name" => "feedback_url", "label" => "Feedback URL", "type" => "text", "desc" => "(optional) Enter the URL to the feedback author e.g. http://www.woothemes.com");
}
// End feedback
if (get_post_type() == 'portfolio' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "portfolio-image", "label" => "Portfolio Image", "type" => "upload", "desc" => "Upload an image or enter an URL to your portfolio image");
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Video Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar). Will show instead of your image.");
$woo_metaboxes[] = array("name" => "embed-url", "label" => "Video URL", "type" => "text", "desc" => "Enter a URL to your video (for use in the lightbox on the homepage).");
$woo_metaboxes['testimonial'] = array("name" => "testimonial", "label" => "Testimonial", "type" => "textarea", "desc" => "Enter a testimonial from your client to be displayed on the single portfolio page");
$woo_metaboxes['testimonial_author'] = array("name" => "testimonial_author", "label" => "Testimonial Author", "type" => "text", "desc" => "Enter the name of the author of the testimonial e.g. Joe Bloggs");
$woo_metaboxes[] = array("name" => "url", "label" => "URL", "type" => "text", "desc" => "Enter URL of your clients site. (optional) ");
}
//End portfolio
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例7: woo_options
function woo_options()
{
// VARIABLES
$themename = "Bueno";
$manualurl = 'http://www.woothemes.com/support/theme-documentation/bueno/';
$shortname = "woo";
$GLOBALS['template_path'] = get_bloginfo('template_directory');
//Access the WordPress Categories via an Array
$woo_categories = array();
$woo_categories_obj = get_categories('hide_empty=0');
foreach ($woo_categories_obj as $woo_cat) {
$woo_categories[$woo_cat->cat_ID] = $woo_cat->cat_name;
}
$categories_tmp = array_unshift($woo_categories, "Select a category:");
//Access the WordPress Pages via an Array
$woo_pages = array();
$woo_pages_obj = get_pages('sort_column=post_parent,menu_order');
foreach ($woo_pages_obj as $woo_page) {
$woo_pages[$woo_page->ID] = $woo_page->post_name;
}
$woo_pages_tmp = array_unshift($woo_pages, "Select a page:");
//Testing
$options_select = array("one", "two", "three", "four", "five");
$options_radio = array("one" => "One", "two" => "Two", "three" => "Three", "four" => "Four", "five" => "Five");
//Stylesheets Reader
$alt_stylesheet_path = TEMPLATEPATH . '/styles/';
$alt_stylesheets = array();
if (is_dir($alt_stylesheet_path)) {
if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) {
while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) {
if (stristr($alt_stylesheet_file, ".css") !== false) {
$alt_stylesheets[] = $alt_stylesheet_file;
}
}
}
}
//More Options
$other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19");
// THIS IS THE DIFFERENT FIELDS
$options = array();
$options[] = array("name" => "General Settings", "icon" => "general", "type" => "heading");
$options[] = array("name" => "Theme Stylesheet", "desc" => "Select your themes alternative color scheme.", "id" => $shortname . "_alt_stylesheet", "std" => "default.css", "type" => "select", "options" => $alt_stylesheets);
$options[] = array("name" => "Custom Logo", "desc" => "Upload a logo for your theme, or specify an image URL directly.", "id" => $shortname . "_logo", "std" => "", "type" => "upload");
$options[] = array("name" => "Text Title", "desc" => "Enable if you want Blog Title and Tagline to be text-based. Setup title/tagline in WP -> Settings -> General.", "id" => $shortname . "_texttitle", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Favicon", "desc" => "Upload a 16px x 16px <a href='http://www.faviconr.com/'>ico image</a> that will represent your website's favicon.", "id" => $shortname . "_custom_favicon", "std" => "", "type" => "upload");
$options[] = array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.", "id" => $shortname . "_google_analytics", "std" => "", "type" => "textarea");
$options[] = array("name" => "RSS URL", "desc" => "Enter your preferred RSS URL. (Feedburner or other)", "id" => $shortname . "_feedburner_url", "std" => "", "type" => "text");
$options[] = array("name" => "E-Mail URL", "desc" => "Enter your preferred E-mail subscription URL. (Feedburner or other)", "id" => $shortname . "_feedburner_id", "std" => "", "type" => "text");
$options[] = array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => $shortname . "_custom_css", "std" => "", "type" => "textarea");
$options[] = array("name" => "Post Content", "desc" => "Select if you want to show the full content or the excerpt on posts. ", "id" => $shortname . "_post_content", "type" => "select2", "options" => array("excerpt" => "The Excerpt", "content" => "Full Content"));
$options[] = array("name" => "Dynamic Images", "icon" => "image", "type" => "heading");
$options[] = array("name" => 'Dynamic Image Resizing', "desc" => "", "id" => $shortname . "_wpthumb_notice", "std" => 'There are two alternative methods of dynamically resizing the thumbnails in the theme, <strong>WP Post Thumbnail</strong> or <strong>TimThumb - Custom Settings panel</strong>. We recommend using WP Post Thumbnail option.', "type" => "info");
$options[] = array("name" => "WP Post Thumbnail", "desc" => "Use WordPress post thumbnail to assign a post thumbnail. Will enable the <strong>Featured Image panel</strong> in your post sidebar where you can assign a post thumbnail.", "id" => $shortname . "_post_image_support", "std" => "true", "class" => "collapsed", "type" => "checkbox");
$options[] = array("name" => "WP Post Thumbnail - Dynamic Image Resizing", "desc" => "The post thumbnail will be dynamically resized using native WP resize functionality. <em>(Requires PHP 5.2+)</em>", "id" => $shortname . "_pis_resize", "std" => "true", "class" => "hidden", "type" => "checkbox");
$options[] = array("name" => "WP Post Thumbnail - Hard Crop", "desc" => "The post thumbnail will be cropped to match the target aspect ratio (only used if 'Dynamic Image Resizing' is enabled).", "id" => $shortname . "_pis_hard_crop", "std" => "true", "class" => "hidden last", "type" => "checkbox");
$options[] = array("name" => "TimThumb - Custom Settings Panel", "desc" => "This will enable the <a href='http://code.google.com/p/timthumb/'>TimThumb</a> (thumb.php) script which dynamically resizes images added through the <strong>custom settings panel below the post</strong>. Make sure your themes <em>cache</em> folder is writable. <a href='http://www.woothemes.com/2008/10/troubleshooting-image-resizer-thumbphp/'>Need help?</a>", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Automatic Image Thumbnail", "desc" => "If no thumbnail is specifified then the first uploaded image in the post is used.", "id" => $shortname . "_auto_img", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_get_image_width', 'type' => 'text', 'std' => 200, 'meta' => 'Width'), array('id' => $shortname . '_get_image_height', 'type' => 'text', 'std' => 500, 'meta' => 'Height')));
$options[] = array("name" => "Add thumbnail to RSS feed", "desc" => "Add the the image uploaded via your Custom Settings to your RSS feed", "id" => $shortname . "_rss_thumb", "std" => "false", "type" => "checkbox");
//Advertising
$options[] = array("name" => "Sidebar Ad (300x250px)", "icon" => "ads", "type" => "heading");
$options[] = array("name" => "Adsense code", "desc" => "Enter your adsense code (or other ad network code) here.", "id" => $shortname . "_ad_300_adsense", "std" => "", "type" => "textarea");
$options[] = array("name" => "Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_300_image", "std" => "http://www.woothemes.com/ads/300x250b.jpg", "type" => "upload");
$options[] = array("name" => "Destination URL", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_300_url", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Sidebar Ads (125x125)", "icon" => "ads", "type" => "heading");
$options[] = array("name" => "Rotate banners?", "desc" => "Check this to randomly rotate the banner ads.", "id" => $shortname . "_ads_rotate", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Banner Ad #1 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_1", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #1 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_1", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Banner Ad #2 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_2", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #2 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_2", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Banner Ad #3 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_3", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #3 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_3", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Banner Ad #4 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_4", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #4 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_4", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Banner Ad #5 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_5", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #5 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_5", "std" => "http://www.woothemes.com", "type" => "text");
$options[] = array("name" => "Banner Ad #6 - Image Location", "desc" => "Enter the URL for this banner ad.", "id" => $shortname . "_ad_image_6", "std" => "http://www.woothemes.com/ads/125x125b.jpg", "type" => "text");
$options[] = array("name" => "Banner Ad #6 - Destination", "desc" => "Enter the URL where this banner ad points to.", "id" => $shortname . "_ad_url_6", "std" => "http://www.woothemes.com", "type" => "text");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
$woo_metaboxes = array("image" => array("name" => "image", "default" => "", "label" => "Image", "type" => "upload", "desc" => "Enter the URL for image to be used by the Dynamic Image resizer."));
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
//.........这里部分代码省略.........
示例8: woo_options
//.........这里部分代码省略.........
$options[] = array('name' => __('LinkedIn URL', 'woothemes'), 'desc' => __('Enter your <a href="http://www.www.linkedin.com.com/">LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes', 'woothemes'), 'id' => $shortname . '_connect_linkedin', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Delicious URL', 'woothemes'), 'desc' => __('Enter your <a href="http://www.delicious.com/">Delicious</a> URL e.g. http://www.delicious.com/woothemes', 'woothemes'), 'id' => $shortname . '_connect_delicious', 'std' => '', 'type' => 'text');
$options[] = array('name' => __('Google+ URL', 'woothemes'), 'desc' => __('Enter your <a href="http://plus.google.com/">Google+</a> URL e.g. https://plus.google.com/104560124403688998123/', 'woothemes'), 'id' => $shortname . '_connect_googleplus', 'std' => '', 'type' => 'text');
/* Advertising */
/*$options[] = array( 'name' => __( 'Advertising', 'woothemes' ),
'type' => 'heading',
'icon' => "ads" );
$options[] = array( 'name' => __( 'Top Ad (468x60px)', 'woothemes' ),
'type' => 'subheading' );
$options[] = array( 'name' => __( 'Enable Ad', 'woothemes' ),
'desc' => __( 'Enable the ad space', 'woothemes' ),
'id' => $shortname . '_ad_top',
'std' => 'false',
'type' => 'checkbox' );
$options[] = array( 'name' => __( 'Adsense code', 'woothemes' ),
'desc' => __( 'Enter your adsense code (or other ad network code) here.', 'woothemes' ),
'id' => $shortname . '_ad_top_adsense',
'std' => '',
'type' => 'textarea' );
$options[] = array( 'name' => __( 'Image Location', 'woothemes' ),
'desc' => __( 'Enter the URL to the banner ad image location.', 'woothemes' ),
'id' => $shortname . '_ad_top_image',
'std' => "http://www.woothemes.com/ads/468x60b.jpg",
'type' => 'upload' );
$options[] = array( 'name' => __( 'Destination URL', 'woothemes' ),
'desc' => __( 'Enter the URL where this banner ad points to.', 'woothemes' ),
'id' => $shortname . '_ad_top_url',
'std' => "http://www.woothemes.com",
'type' => 'text' );*/
/* Contact Template Settings */
$options[] = array('name' => "Contact Page", 'icon' => 'maps', 'type' => 'heading');
$options[] = array('name' => "Contact Information", 'type' => 'subheading');
$options[] = array('name' => "Your Twitter username", 'desc' => "Enter your Twitter username. Example: woothemes", 'id' => $shortname . '_contact_twitter', 'std' => 'woothemes', 'type' => 'text');
$options[] = array('name' => "Location Name", 'desc' => "Enter the location name. Example: London Office", 'id' => $shortname . '_contact_title', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Location Address", 'desc' => "Enter your company's address", 'id' => $shortname . '_contact_address', 'std' => '', 'type' => "textarea");
$options[] = array('name' => "Telephone", 'desc' => "Enter your telephone number", 'id' => $shortname . '_contact_number', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Fax", 'desc' => "Enter your fax number", 'id' => $shortname . '_contact_fax', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Email Address", 'desc' => "Enter your email address", 'id' => $shortname . '_contact_email', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Maps", 'type' => 'subheading');
$options[] = array('name' => "Contact Form Google Maps Coordinates", 'desc' => 'Enter your Google Map coordinates to display a map on the Contact Form page template and a link to it on the Contact Us widget. You can get these details from <a href="http://www.getlatlon.com/" target="_blank">Google Maps</a>', 'id' => $shortname . '_contactform_map_coords', 'std' => '', 'type' => 'text');
$options[] = array('name' => "Disable Mousescroll", 'desc' => "Turn off the mouse scroll action for all the Google Maps on the site. This could improve usability on your site.", 'id' => $shortname . '_maps_scroll', 'std' => '', 'type' => 'checkbox');
$options[] = array('name' => "Map Height", 'desc' => "Height in pixels for the maps displayed on Single.php pages.", 'id' => $shortname . '_maps_single_height', 'std' => "250", 'type' => 'text');
$options[] = array('name' => "Default Map Zoom Level", 'desc' => "Set this to adjust the default in the post & page edit backend.", 'id' => $shortname . '_maps_default_mapzoom', 'std' => "9", 'type' => 'select2', 'options' => $other_entries);
$options[] = array('name' => "Default Map Type", 'desc' => "Set this to the default rendered in the post backend.", 'id' => $shortname . '_maps_default_maptype', 'std' => 'G_NORMAL_MAP', 'type' => 'select2', 'options' => array('G_NORMAL_MAP' => 'Normal', 'G_SATELLITE_MAP' => 'Satellite', 'G_HYBRID_MAP' => 'Hybrid', 'G_PHYSICAL_MAP' => 'Terrain'));
$options[] = array('name' => "Map Callout Text", 'desc' => "Text or HTML that will be output when you click on the map marker for your location.", 'id' => $shortname . '_maps_callout_text', 'std' => "", 'type' => 'textarea');
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
global $post;
$woo_metaboxes = array();
// Shown on both posts and pages
// Show only on specific post types or page
if (get_post_type() == 'post' || !get_post_type()) {
// TimThumb is enabled in options
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array('name' => "image", "label" => "Image", 'type' => "upload", 'desc' => "Upload an image or enter an URL.");
$woo_metaboxes[] = array('name' => "_image_alignment", 'std' => "Center", "label" => "Image Crop Alignment", 'type' => 'select2', 'desc' => "Select crop alignment for resized image", 'options' => array("c" => "Center", "t" => "Top", "b" => "Bottom", "l" => "Left", "r" => "Right"));
// TimThumb disabled in the options
} else {
$woo_metaboxes[] = array('name' => "_timthumb-info", "label" => "Image", 'type' => "info", 'desc' => "<strong>TimThumb</strong> is disabled. Use the <strong>Featured Image</strong> panel in the sidebar instead, or enable TimThumb in the options panel.");
}
$woo_metaboxes[] = array('name' => "embed", 'std' => '', "label" => "Embed Code", 'type' => "textarea", 'desc' => "Enter the video embed code for your video (YouTube, Vimeo or similar)");
}
// End post
// CPT slide image option
if (get_post_type() == 'slide' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Slide Image", "type" => "upload", "desc" => "Upload an image or enter an URL to your slide image");
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Video Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar). Will show instead of your image.");
$woo_metaboxes[] = array("name" => "url", "label" => "URL", "type" => "text", "desc" => "Enter URL if you want to add a link to the uploaded image and title. (optional) ");
}
//End slide
$woo_metaboxes[] = array('name' => "_layout", 'std' => "normal", "label" => "Layout", 'type' => "images", 'desc' => "Select the layout you want on this specific post/page.", 'options' => array('layout-default' => $url . 'layout-off.png', 'layout-full' => get_template_directory_uri() . '/functions/images/' . '1c.png', 'layout-left-content' => get_template_directory_uri() . '/functions/images/' . '2cl.png', 'layout-right-content' => get_template_directory_uri() . '/functions/images/' . '2cr.png'));
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例9: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => "Body Background Color", "desc" => "Pick a custom color for background color of the theme e.g. #697e09", "id" => "woo_body_color", "std" => "", "type" => "color");
$options[] = array("name" => "Body background image", "desc" => "Upload an image for the theme's background", "id" => $shortname . "_body_img", "std" => "", "type" => "upload");
$options[] = array("name" => "Background image repeat", "desc" => "Select how you would like to repeat the background-image", "id" => $shortname . "_body_repeat", "std" => "no-repeat", "type" => "select", "options" => $body_repeat);
$options[] = array("name" => "Background image position", "desc" => "Select how you would like to position the background", "id" => $shortname . "_body_pos", "std" => "top", "type" => "select", "options" => $body_pos);
$options[] = array("name" => "Link Color", "desc" => "Pick a custom color for links or add a hex color code e.g. #697e09", "id" => "woo_link_color", "std" => "", "type" => "color");
$options[] = array("name" => "Link Hover Color", "desc" => "Pick a custom color for links hover or add a hex color code e.g. #697e09", "id" => "woo_link_hover_color", "std" => "", "type" => "color");
$options[] = array("name" => "Button Color", "desc" => "Pick a custom color for buttons or add a hex color code e.g. #697e09", "id" => "woo_button_color", "std" => "", "type" => "color");
$options[] = array("name" => "Typography", "type" => "heading", "icon" => "typography");
$options[] = array("name" => "Enable Custom Typography", "desc" => "Enable the use of custom typography for your site. Custom styling will be output in your sites HEAD.", "id" => $shortname . "_typography", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "General Typography", "desc" => "Change the general font.", "id" => $shortname . "_font_body", "std" => array('size' => '12', 'unit' => 'px', 'face' => 'Arial', 'style' => '', 'color' => '#555555'), "type" => "typography");
$options[] = array("name" => "About (Homepage)", "desc" => "Change the about text font.", "id" => $shortname . "_font_about", "std" => array('size' => '32', 'unit' => 'px', 'face' => 'Georgia', 'style' => '', 'color' => '#126661'), "type" => "typography");
$options[] = array("name" => "Navigation", "desc" => "Change the navigation font.", "id" => $shortname . "_font_nav", "std" => array('size' => '15', 'unit' => 'px', 'face' => 'Georgia', 'style' => '', 'color' => '#151515'), "type" => "typography");
$options[] = array("name" => "Post Title", "desc" => "Change the post title.", "id" => $shortname . "_font_post_title", "std" => array('size' => '24', 'unit' => 'px', 'face' => 'Georgia', 'style' => 'bold', 'color' => '#222222'), "type" => "typography");
$options[] = array("name" => "Post Meta", "desc" => "Change the post meta.", "id" => $shortname . "_font_post_meta", "std" => array('size' => '14', 'unit' => 'px', 'face' => 'Georgia', 'style' => '', 'color' => '#999999'), "type" => "typography");
$options[] = array("name" => "Post Entry", "desc" => "Change the post entry.", "id" => $shortname . "_font_post_entry", "std" => array('size' => '13', 'unit' => 'px', 'face' => 'Arial', 'style' => '', 'color' => '#555555'), "type" => "typography");
$options[] = array("name" => "Widget Titles", "desc" => "Change the widget titles.", "id" => $shortname . "_font_widget_titles", "std" => array('size' => '16', 'unit' => 'px', 'face' => 'Georgia', 'style' => 'bold', 'color' => '#555555'), "type" => "typography");
//Header
$options[] = array("name" => "Homepage", "type" => "heading", "icon" => "homepage");
$options[] = array("name" => "Enable About Section", "desc" => "Show a welcome message in your header and add social media icons.", "id" => $shortname . "_about", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "About Message", "desc" => "Enter an about message that will show just below the logo", "id" => $shortname . "_header_bio", "std" => "Edit this welcome message in your options panel", "type" => "textarea");
$options[] = array("name" => "Facebook", "desc" => "Enter your profile url", "id" => $shortname . "_social_facebook", "std" => "", "type" => "text");
$options[] = array("name" => "Linkedin", "desc" => "Enter your profile url", "id" => $shortname . "_social_linkedin", "std" => "", "type" => "text");
$options[] = array("name" => "Twitter", "desc" => "Enter your profile url", "id" => $shortname . "_social_twitter", "std" => "", "type" => "text");
$options[] = array("name" => "Portfolio", "icon" => "portfolio", "type" => "heading");
$options[] = array("name" => "Enable Portfolio", "desc" => "Enable the portfolio section below the about section. Add portfolio posts using the 'Portfolio' custom post type.", "id" => $shortname . "_portfolio", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Number of portfolio items", "id" => $shortname . "_portfolio_number", "std" => "4", "type" => "select", "options" => $other_entries);
$options[] = array("name" => "Portfolio Tags", "desc" => "Enter comma seperated tags for portfolio sorting (e.g. web, print, icons). You must add these tags to the portfolio items you want to sort.", "id" => $shortname . "_portfolio_tags", "std" => "", "type" => "text");
$options[] = array("name" => "Tumblog Setup", "icon" => "tumblog", "type" => "heading");
$content_option_array = array('taxonomy' => 'Taxonomy', 'post_format' => 'Post Formats');
$options[] = array("name" => "Tumblog Content Method", "desc" => "Select if you would like to use a Taxonomy of Post Formats to categorize your Tumblog content.", "id" => $shortname . "_tumblog_content_method", "std" => "post_format", "type" => "select2", "options" => $content_option_array);
$options[] = array("name" => "Use Custom Tumblog RSS Feed", "desc" => "Replaces the default WordPress RSS feed output with Tumblog RSS output.", "id" => $shortname . "_custom_rss", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Full Content Home", "desc" => "Show the full content in posts on homepage instead of the excerpt.", "id" => $shortname . "_home_content", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Full Content Archive", "desc" => "Show the full content in posts on archive pages instead of the excerpt.", "id" => $shortname . "_archive_content", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Images Link to", "desc" => "Select where your Tumblog Images will link to when clicked.", "id" => $shortname . "_image_link_to", "std" => "post", "type" => "radio", "options" => $options_image_link_to);
$options[] = array("name" => "URL Shortening Service", "desc" => $short_url_msg, "id" => $shortname . "_url_shorten", "std" => "Select a Service:", "type" => "select", "options" => $options_select);
$options[] = array("name" => "Bit.ly Login Name", "desc" => "Your Bit.ly login name - get this here <a href='http://bit.ly/account/' target='_blank'>http://bit.ly/account/</a>", "id" => $shortname . "_bitly_api_login", "std" => "", "type" => "text");
$options[] = array("name" => "Bit.ly API Key", "desc" => "Your Bit.ly API Key - get this here <a href='http://bit.ly/account/' target='_blank'>http://bit.ly/account/</a>", "id" => $shortname . "_bitly_api_key", "std" => "", "type" => "text");
$options[] = array("name" => "Dynamic Images", "type" => "heading", "icon" => "image");
$options[] = array("name" => "Enable WordPress Post Thumbnail Support", "desc" => "Use WordPress post thumbnail support to assign a post thumbnail.", "id" => $shortname . "_post_image_support", "std" => "true", "class" => "collapsed", "type" => "checkbox");
$options[] = array("name" => "Dynamically Resize Post Thumbnail", "desc" => "The post thumbnail will be dynamically resized using native WP resize functionality. <em>(Requires PHP 5.2+)</em>", "id" => $shortname . "_pis_resize", "std" => "true", "class" => "hidden", "type" => "checkbox");
$options[] = array("name" => "Hard Crop Post Thumbnail", "desc" => "The image will be cropped to match the target aspect ratio.", "id" => $shortname . "_pis_hard_crop", "std" => "true", "class" => "hidden last", "type" => "checkbox");
$options[] = array("name" => "Enable Dynamic Image Resizer", "desc" => "This will enable the thumb.php script which dynamically resizes images on your site.", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Dynamic Image Height", "desc" => "If this is enabled, the height of your images will be dynamically calculated based on the width's as set below.", "id" => $shortname . "_dynamic_img_height", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Thumbnail Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the desired size which will be used when dynamically creating the images.", "id" => $shortname . "_image_dimensions", "std" => "", "type" => array(array('id' => $shortname . '_thumb_w', 'type' => 'text', 'std' => 550, 'meta' => 'Width'), array('id' => $shortname . '_thumb_h', 'type' => 'text', 'std' => 412, 'meta' => 'Height')));
$options[] = array("name" => "Thumbnail Image alignment", "desc" => "Select how to align your thumbnails with posts.", "id" => $shortname . "_thumb_align", "std" => "aligncenter", "type" => "radio", "options" => $options_thumb_align);
$options[] = array("name" => "Show thumbnail in Single Posts", "desc" => "Show the attached image in the single post page.", "id" => $shortname . "_thumb_single", "class" => "collapsed", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "Single Image Dimensions", "desc" => "Enter an integer value i.e. 250 for the image size. Max width is 576.", "id" => $shortname . "_image_dimensions", "std" => "", "class" => "hidden last", "type" => array(array('id' => $shortname . '_single_w', 'type' => 'text', 'std' => 550, 'meta' => 'Width'), array('id' => $shortname . '_single_h', 'type' => 'text', 'std' => 412, 'meta' => 'Height')));
$options[] = array("name" => "Single Post Image alignment", "desc" => "Select how to align your thumbnail with single posts.", "id" => $shortname . "_thumb_single_align", "std" => "aligncenter", "type" => "radio", "class" => "hidden", "options" => $options_thumb_align);
//Footer
$options[] = array("name" => "Footer Customization", "type" => "heading", "icon" => "footer");
$options[] = array("name" => "Custom Affiliate Link", "desc" => "Add an affiliate link to the WooThemes logo in the footer of the theme.", "id" => $shortname . "_footer_aff_link", "std" => "", "type" => "text");
$options[] = array("name" => "Enable Custom Footer (Left)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_left", "class" => "collapsed", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Left)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_left_text", "class" => "hidden last", "std" => "<p></p>", "type" => "textarea");
$options[] = array("name" => "Enable Custom Footer (Right)", "desc" => "Activate to add the custom text below to the theme footer.", "id" => $shortname . "_footer_right", "class" => "collapsed", "std" => "false", "type" => "checkbox");
$options[] = array("name" => "Custom Text (Right)", "desc" => "Custom HTML and Text that will appear in the footer of your theme.", "id" => $shortname . "_footer_right_text", "class" => "hidden last", "std" => "<p></p>", "type" => "textarea");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
$woo_metaboxes = array();
global $post;
if (get_post_type() == 'post' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "image", "label" => "Image", "type" => "upload", "desc" => "Upload file here...");
$woo_metaboxes[] = array("name" => "video-embed", "label" => "Embed Code (Videos)", "type" => "textarea", "desc" => "Add embed code for video services like Youtube or Vimeo");
$woo_metaboxes[] = array("name" => "quote-author", "std" => "Unknown", "label" => "Quote Author", "type" => "text", "desc" => "Enter the name of the Quote Author.");
$woo_metaboxes[] = array("name" => "quote-url", "std" => "http://", "label" => "Link to Quote", "type" => "text", "desc" => "Enter the url/web address of the Quote if available.");
$woo_metaboxes[] = array("name" => "quote-copy", "std" => "Unknown", "label" => "Quote", "type" => "textarea", "desc" => "Enter the Quote.");
$woo_metaboxes[] = array("name" => "audio", "std" => "http://", "label" => "Audio URL", "type" => "text", "desc" => "Enter the url/web address of the Audio file.");
$woo_metaboxes[] = array("name" => "link-url", "std" => "http://", "label" => "Link URL", "type" => "text", "desc" => "Enter the url/web address of the Link.");
}
// End post
if (get_post_type() == 'portfolio' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "portfolio-image", "label" => "Portfolio Image", "type" => "upload", "desc" => "Upload an image or enter an URL to your portfolio image");
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array("name" => "_image_alignment", "std" => "Center", "label" => "Image Crop Alignment", "type" => "select2", "desc" => "Select crop alignment for resized image", "options" => array("c" => "Center", "t" => "Top", "b" => "Bottom", "l" => "Left", "r" => "Right"));
}
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => "Video Embed Code", "type" => "textarea", "desc" => "Enter the video embed code for your video (YouTube, Vimeo or similar). Will show instead of your image.");
}
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
}
示例10: woo_options
//.........这里部分代码省略.........
"type" => "text");
$options[] = array( "name" => "Banner Ad #2 - Image Location",
"desc" => "Enter the URL for this banner ad.",
"id" => $shortname."_ad_image_2",
"std" => "http://www.woothemes.com/ads/125x125b.jpg",
"type" => "text");
$options[] = array( "name" => "Banner Ad #2 - Destination",
"desc" => "Enter the URL where this banner ad points to.",
"id" => $shortname."_ad_url_2",
"std" => "http://www.woothemes.com",
"type" => "text");
$options[] = array( "name" => "Banner Ad #3 - Image Location",
"desc" => "Enter the URL for this banner ad.",
"id" => $shortname."_ad_image_3",
"std" => "http://www.woothemes.com/ads/125x125b.jpg",
"type" => "text");
$options[] = array( "name" => "Banner Ad #3 - Destination",
"desc" => "Enter the URL where this banner ad points to.",
"id" => $shortname."_ad_url_3",
"std" => "http://www.woothemes.com",
"type" => "text");
$options[] = array( "name" => "Banner Ad #4 - Image Location",
"desc" => "Enter the URL for this banner ad.",
"id" => $shortname."_ad_image_4",
"std" => "http://www.woothemes.com/ads/125x125b.jpg",
"type" => "text");
$options[] = array( "name" => "Banner Ad #4 - Destination",
"desc" => "Enter the URL where this banner ad points to.",
"id" => $shortname."_ad_url_4",
"std" => "http://www.woothemes.com",
"type" => "text");
// Add extra options through function
if ( function_exists("woo_options_add") )
$options = woo_options_add($options);
if ( get_option('woo_template') != $options) update_option('woo_template',$options);
if ( get_option('woo_themename') != $themename) update_option('woo_themename',$themename);
if ( get_option('woo_shortname') != $shortname) update_option('woo_shortname',$shortname);
if ( get_option('woo_manual') != $manualurl) update_option('woo_manual',$manualurl);
// Woo Metabox Options
$woo_metaboxes = array(
"image" => array (
"name" => "image",
"label" => "Image",
"type" => "upload",
"desc" => "Upload file here..."
),
"embed" => array (
"name" => "embed",
"std" => "",
"label" => "Embed Code",
"type" => "textarea",
"desc" => "Enter the video embed code for your video player"
)
);
// Add extra metaboxes through function
if ( function_exists("woo_metaboxes_add") )
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
if ( get_option('woo_custom_template') != $woo_metaboxes) update_option('woo_custom_template',$woo_metaboxes);
/*
function woo_update_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
function woo_add_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
//add_action('switch_theme', 'woo_update_options');
if(get_option('template') == 'wooframework'){
woo_add_options();
} // end function
*/
}
示例11: woo_options
function woo_options()
{
// VARIABLES
$themename = "Snapshot";
$manualurl = 'http://www.woothemes.com/support/theme-documentation/snapshot/';
$shortname = "woo";
$GLOBALS['template_path'] = get_bloginfo('template_directory');
//Access the WordPress Categories via an Array
$woo_categories = array();
$woo_categories_obj = get_categories('hide_empty=0');
foreach ($woo_categories_obj as $woo_cat) {
$woo_categories[$woo_cat->cat_ID] = $woo_cat->cat_name;
}
$categories_tmp = array_unshift($woo_categories, "Select a category:");
//Access the WordPress Pages via an Array
$woo_pages = array();
$woo_pages_obj = get_pages('sort_column=post_parent,menu_order');
foreach ($woo_pages_obj as $woo_page) {
$woo_pages[$woo_page->ID] = $woo_page->post_name;
}
$woo_pages_tmp = array_unshift($woo_pages, "Select a page:");
//Stylesheets Reader
$alt_stylesheet_path = TEMPLATEPATH . '/styles/';
$alt_stylesheets = array();
if (is_dir($alt_stylesheet_path)) {
if ($alt_stylesheet_dir = opendir($alt_stylesheet_path)) {
while (($alt_stylesheet_file = readdir($alt_stylesheet_dir)) !== false) {
if (stristr($alt_stylesheet_file, ".css") !== false) {
$alt_stylesheets[] = $alt_stylesheet_file;
}
}
}
}
//More Options
$other_entries = array("Select a number:", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19");
$layouts = array("1-photo.php", "2-gallery.php");
// THIS IS THE DIFFERENT FIELDS
$options = array();
$options[] = array("name" => "General Settings", "type" => "heading");
$options[] = array("name" => "Theme Stylesheet", "desc" => "Select your themes alternative color scheme.", "id" => $shortname . "_alt_stylesheet", "std" => "default.css", "type" => "select", "options" => $alt_stylesheets);
$options[] = array("name" => "Custom Logo", "desc" => "Upload a logo for your theme, or specify an image URL directly.", "id" => $shortname . "_logo", "std" => "", "type" => "upload");
$options[] = array("name" => "Custom Favicon", "desc" => "Upload a 16px x 16px <a href='http://www.faviconr.com/'>ico image</a> that will represent your website's favicon.", "id" => $shortname . "_custom_favicon", "std" => "", "type" => "upload");
$options[] = array("name" => "Tracking Code", "desc" => "Paste your Google Analytics (or other) tracking code here. This will be added into the footer template of your theme.", "id" => $shortname . "_google_analytics", "std" => "", "type" => "textarea");
$options[] = array("name" => "Enable Dynamic Image Resizer", "desc" => "This will enable the thumb.php script. It dynamically resizes images on your site.", "id" => $shortname . "_resize", "std" => "true", "type" => "checkbox");
$options[] = array("name" => "RSS URL", "desc" => "Enter your preferred RSS URL. (Feedburner or other)", "id" => $shortname . "_feedburner_url", "std" => "", "type" => "text");
$options[] = array("name" => "Custom CSS", "desc" => "Quickly add some CSS to your theme by adding it to this block.", "id" => $shortname . "_custom_css", "std" => "", "type" => "textarea");
$options[] = array("name" => "Layout Settings", "type" => "heading");
$options[] = array("name" => "Photo or Design Gallery?", "desc" => "Select whether you are using this as a showcase of your own photos or a gallery of others designs.", "id" => $shortname . "_layout", "std" => "", "type" => "select", "options" => $layouts);
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
$woo_metaboxes = array("image" => array("name" => "image", "default" => "", "label" => "Screenshot (330x190)", "type" => "upload"), "large-image" => array("name" => "large-image", "default" => "", "label" => "Large Image (Max Width: 690px)", "type" => "upload"), "url" => array("name" => "url", "default" => "", "label" => "Website URL", "type" => "text"));
// Add extra metaboxes through function
if (function_exists("woo_metaboxes_add")) {
$woo_metaboxes = woo_metaboxes_add($woo_metaboxes);
}
if (get_option('woo_custom_template') != $woo_metaboxes) {
update_option('woo_custom_template', $woo_metaboxes);
}
/*
function woo_update_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
function woo_add_options(){
$options = get_option('woo_template',$options);
foreach ($options as $option){
update_option($option['id'],$option['std']);
}
}
//add_action('switch_theme', 'woo_update_options');
if(get_option('template') == 'wooframework'){
woo_add_options();
} // end function
*/
}
示例12: woo_options
//.........这里部分代码省略.........
$options[] = array("name" => __('Thumbnail Image alignment', 'woothemes'), "desc" => __('Select how to align your thumbnails with posts.', 'woothemes'), "id" => $shortname . "_thumb_align", "std" => "alignright", "type" => "radio", "options" => array("alignleft" => __('Left', 'woothemes'), "alignright" => __('Right', 'woothemes'), "aligncenter" => __('Center', 'woothemes')));
$options[] = array("name" => __('Show thumbnail in Single Posts', 'woothemes'), "desc" => __('Show the attached image in the single post page.', 'woothemes'), "id" => $shortname . "_thumb_single", "class" => "collapsed", "std" => "false", "type" => "checkbox");
$options[] = array("name" => __('Single Image Dimensions', 'woothemes'), "desc" => __('"Enter an integer value i.e. 250 for the image size. Max width is 576.', 'woothemes'), "id" => $shortname . "_image_dimensions", "std" => "", "class" => "hidden last", "type" => array(array('id' => $shortname . '_single_w', 'type' => 'text', 'std' => 200, 'meta' => __('Width', 'woothemes')), array('id' => $shortname . '_single_h', 'type' => 'text', 'std' => 200, 'meta' => __('Height', 'woothemes'))));
$options[] = array("name" => __('Single Post Image alignment', 'woothemes'), "desc" => __('Select how to align your thumbnail with single posts.', 'woothemes'), "id" => $shortname . "_thumb_single_align", "std" => "alignright", "type" => "radio", "class" => "hidden", "options" => array("alignleft" => __('Left', 'woothemes'), "alignright" => __('Right', 'woothemes'), "aligncenter" => __('Center', 'woothemes')));
$options[] = array("name" => __('Add thumbnail to RSS feed', 'woothemes'), "desc" => __('Add the the image uploaded via your Custom Settings to your RSS feed', 'woothemes'), "id" => $shortname . "_rss_thumb", "std" => "false", "type" => "checkbox");
$options[] = array("name" => __('Enable Lightbox', 'woothemes'), "desc" => __('Enable the PrettyPhoto lighbox script on images within your website\'s content.', 'woothemes'), "id" => $shortname . "_enable_lightbox", "std" => "false", "type" => "checkbox");
/* Footer */
$options[] = array("name" => __('Footer Customization', 'woothemes'), "type" => "heading", "icon" => "footer");
$options[] = array("name" => __('Title', 'woothemes'), "desc" => __('Add a heading for the widgetized footer regions.', 'woothemes'), "id" => $shortname . "_footer_title", "std" => '', "type" => "text");
$url = get_template_directory_uri() . '/functions/images/';
$options[] = array("name" => __('Footer Widget Areas', 'woothemes'), "desc" => __('Select how many footer widget areas you want to display.', 'woothemes'), "id" => $shortname . "_footer_sidebars", "std" => "4", "type" => "images", "options" => array('0' => $url . 'layout-off.png', '1' => $url . 'footer-widgets-1.png', '2' => $url . 'footer-widgets-2.png', '3' => $url . 'footer-widgets-3.png', '4' => $url . 'footer-widgets-4.png'));
$options[] = array("name" => __('Custom Affiliate Link', 'woothemes'), "desc" => __('Add an affiliate link to the WooThemes logo in the footer of the theme.', 'woothemes'), "id" => $shortname . "_footer_aff_link", "std" => "", "type" => "text");
$options[] = array("name" => __('Enable Custom Footer (Left)', 'woothemes'), "desc" => __('Activate to add the custom text below to the theme footer.', 'woothemes'), "id" => $shortname . "_footer_left", "std" => "false", "type" => "checkbox");
$options[] = array("name" => __('Custom Text (Left)', 'woothemes'), "desc" => __('Custom HTML and Text that will appear in the footer of your theme.', 'woothemes'), "id" => $shortname . "_footer_left_text", "std" => "", "type" => "textarea");
$options[] = array("name" => __('Enable Custom Footer (Right)', 'woothemes'), "desc" => __('Activate to add the custom text below to the theme footer.', 'woothemes'), "id" => $shortname . "_footer_right", "std" => "false", "type" => "checkbox");
$options[] = array("name" => __('Custom Text (Right)', 'woothemes'), "desc" => __('Custom HTML and Text that will appear in the footer of your theme.', 'woothemes'), "id" => $shortname . "_footer_right_text", "std" => "", "type" => "textarea");
/* Subscribe & Connect */
$options[] = array("name" => __('Subscribe & Connect', 'woothemes'), "type" => "heading", "icon" => "connect");
$options[] = array("name" => __('Enable Subscribe & Connect - Single Post', 'woothemes'), "desc" => sprintf(__('Enable the subscribe & connect area on single posts. You can also add this as a %1$s in your sidebar.', 'woothemes'), '<a href="' . home_url() . '/nxt-admin/widgets.php">widget</a>'), "id" => $shortname . "_connect", "std" => 'false', "type" => "checkbox");
$options[] = array("name" => __('Subscribe Title', 'woothemes'), "desc" => __('Enter the title to show in your subscribe & connect area.', 'woothemes'), "id" => $shortname . "_connect_title", "std" => '', "type" => "text");
$options[] = array("name" => __('Text', 'woothemes'), "desc" => __('Change the default text in this area.', 'woothemes'), "id" => $shortname . "_connect_content", "std" => '', "type" => "textarea");
$options[] = array("name" => __('Subscribe By E-mail ID (Feedburner)', 'woothemes'), "desc" => __('Enter your <a href="http://www.google.com/support/feedburner/bin/answer.py?hl=en&answer=78982">Feedburner ID</a> for the e-mail subscription form.', 'woothemes'), "id" => $shortname . "_connect_newsletter_id", "std" => '', "type" => "text");
$options[] = array("name" => __('Subscribe By E-mail to MailChimp', 'woothemes', 'woothemes'), "desc" => __('If you have a MailChimp account you can enter the <a href="http://woochimp.heroku.com" target="_blank">MailChimp List Subscribe URL</a> to allow your users to subscribe to a MailChimp List.', 'woothemes'), "id" => $shortname . "_connect_mailchimp_list_url", "std" => '', "type" => "text");
$options[] = array("name" => __('Enable RSS', 'woothemes'), "desc" => __('Enable the subscribe and RSS icon.', 'woothemes'), "id" => $shortname . "_connect_rss", "std" => 'true', "type" => "checkbox");
$options[] = array("name" => __('Twitter URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.twitter.com/">Twitter</a> URL e.g. http://www.twitter.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_twitter", "std" => '', "type" => "text");
$options[] = array("name" => __('Facebook URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.facebook.com/">Facebook</a> URL e.g. http://www.facebook.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_facebook", "std" => '', "type" => "text");
$options[] = array("name" => __('YouTube URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.youtube.com/">YouTube</a> URL e.g. http://www.youtube.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_youtube", "std" => '', "type" => "text");
$options[] = array("name" => __('Flickr URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.flickr.com/">Flickr</a> URL e.g. http://www.flickr.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_flickr", "std" => '', "type" => "text");
$options[] = array("name" => __('LinkedIn URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.www.linkedin.com.com/">LinkedIn</a> URL e.g. http://www.linkedin.com/in/woothemes', 'woothemes'), "id" => $shortname . "_connect_linkedin", "std" => '', "type" => "text");
$options[] = array("name" => __('Delicious URL', 'woothemes'), "desc" => __('Enter your <a href="http://www.delicious.com/">Delicious</a> URL e.g. http://www.delicious.com/woothemes', 'woothemes'), "id" => $shortname . "_connect_delicious", "std" => '', "type" => "text");
$options[] = array("name" => __('Google+ URL', 'woothemes'), "desc" => __('Enter your <a href="http://plus.google.com/">Google+</a> URL e.g. https://plus.google.com/104560124403688998123/', 'woothemes'), "id" => $shortname . "_connect_googleplus", "std" => '', "type" => "text");
$options[] = array("name" => __('Enable Related Posts', 'woothemes'), "desc" => __('Enable related posts in the subscribe area. Uses posts with the same <strong>tags</strong> to find related posts. Note: Will not show in the Subscribe widget.', 'woothemes'), "id" => $shortname . "_connect_related", "std" => 'true', "type" => "checkbox");
// Add extra options through function
if (function_exists("woo_options_add")) {
$options = woo_options_add($options);
}
if (get_option('woo_template') != $options) {
update_option('woo_template', $options);
}
if (get_option('woo_themename') != $themename) {
update_option('woo_themename', $themename);
}
if (get_option('woo_shortname') != $shortname) {
update_option('woo_shortname', $shortname);
}
if (get_option('woo_manual') != $manualurl) {
update_option('woo_manual', $manualurl);
}
// Woo Metabox Options
// Start name with underscore to hide custom key from the user
$woo_metaboxes = array();
global $post;
/* "portfolio" Custom Post Type. */
if (get_post_type() == 'portfolio' || !get_post_type()) {
$woo_metaboxes[] = array("name" => "portfolio-image", "label" => __('Portfolio Image', 'woothemes'), "type" => "upload", "desc" => __('Upload an image or enter an URL to your portfolio image', 'woothemes'));
if (get_option('woo_resize') == "true") {
$woo_metaboxes[] = array("name" => "_image_alignment", "std" => "c", "label" => __('Image Crop Alignment', 'woothemes'), "type" => "select2", "desc" => __('Select crop alignment for resized image', 'woothemes'), "options" => array("c" => __('Center', 'woothemes'), "t" => __('Top', 'woothemes'), "b" => __('Bottom', 'woothemes'), "l" => __('Left', 'woothemes'), "r" => __('Right', 'woothemes')));
}
$woo_metaboxes[] = array("name" => "embed", "std" => "", "label" => __('Video Embed Code', 'woothemes'), "type" => "textarea", "desc" => __('Enter the video embed code for your video (YouTube, Vimeo or similar). Will show instead of your image.', 'woothemes'));
$woo_metaboxes['lightbox-description'] = array("name" => "lightbox-description", "label" => __('Custom Lightbox Description', 'woothemes'), "type" => "textarea", "desc" => sprintf(__('Enter an optional description to show in the %s for this portfolio item. This will be the description for all items in the gallery, if one is available.', 'woothemes'), '<a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">' . __('PrettyPhoto lightbox', 'woothemes') . '</a>'));
$woo_metaboxes['lightbox-url'] = array("name" => "lightbox-url", "label" => __('Lightbox URL', 'woothemes'), "type" => "text", "desc" => sprintf(__('Enter an optional URL to show in the %s for this portfolio item.', 'woothemes'), '<a href="http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/">' . __('PrettyPhoto lightbox', 'woothemes') . '</a>'));
$woo_metaboxes['testimonial'] = array("name" => "testimonial", "label" => __('Testimonial', 'woothemes'), "type" => "textarea", "desc" => __('Enter a testimonial from your client to be displayed on the single portfolio page', 'woothemes'));
$woo_metaboxes['testimonial_author'] = array("name" => "testimonial_author", "label" => __('Testimonial Author', 'woothemes'), "type" => "text", "desc" => __('Enter the name of the author of the testimonial e.g. Joe Bloggs', 'woothemes'));
$woo_metaboxes[] = array("name" => "url", "label" => __('URL', 'woothemes'), "type" => "text", "desc" => __('Enter URL of your clients site. (optional)', 'woothemes'));
}
//End portfolio