本文整理汇总了PHP中create_widget函数的典型用法代码示例。如果您正苦于以下问题:PHP create_widget函数的具体用法?PHP create_widget怎么用?PHP create_widget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_widget函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_enqueue_style
{
wp_enqueue_style('bootsrap_css', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
wp_enqueue_style('custom_css', get_template_directory_uri() . '/css/custom.css');
wp_enqueue_style('source_sans_pro_font_css', 'https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,600,700,900,300,200');
wp_enqueue_style('lato_font_css', 'https://fonts.googleapis.com/css?family=Lato:400,300,100,700,900');
}
add_action('wp_enqueue_scripts', 'theme_styles');
function theme_js()
{
global $wp_scripts;
wp_register_script('html5_shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', '', '', false);
wp_register_script('html5_shiv', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', '', '', false);
$wp_scripts->add_data('html5_shiv', 'conditional', 'lt IE 9');
$wp_scripts->add_data('respond_js', 'conditional', 'lt IE 9');
wp_enqueue_script('bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);
wp_enqueue_script('theme_js', get_template_directory_uri() . '/js/app.js', array('jquery', 'bootstrap_js'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_theme_support('menus');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Header Menu'), 'shop-menu' => __('Shop Menu')));
}
add_action('init', 'register_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div', 'before_title' => '<h3>', 'after_tile' => '</h3>'));
}
create_widget('Page Sidebar', 'blog', 'Display on the side of the pages with a sidebar');
add_theme_support('post-thumbnails');
示例2: create_widget
/**
*
* Add Widgets
*
**/
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front-left', 'Displays on the left of the homepage');
create_widget('Front Page Center', 'front-center', 'Displays on the center of the homepage');
create_widget('Front Page Right', 'front-right', 'Displays on the right of the homepage');
create_widget('Sidebar Blog', 'sidebar-blog', 'Displays on the Blog Sidebar');
create_widget('Sidebar Page', 'sidebar-page', 'Displays on the Page Sidebar');
create_widget('Front Page Left', 'front-page-lastrow-left', 'Displays on the Front Page Last Row Left Block');
create_widget('Front Page Right', 'front-page-lastrow-right', 'Displays on the Front Page Last Row Right Block');
function custom_pagination($numpages = '', $pagerange = '', $paged = '')
{
if (empty($pagerange)) {
$pagerange = 2;
}
/**
* This first part of our function is a fallback
* for custom pagination inside a regular loop that
* uses the global $paged and global $wp_query variables.
*
* It's good because we can now override default pagination
* in our theme, and use this function in default quries
* and custom queries.
*/
global $paged;
示例3: wp_enqueue_script
wp_enqueue_script('marked', 'https://cdnjs.cloudflare.com/ajax/libs/marked/0.3.2/marked.min.js', '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_theme_support('menus');
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => 'Header Menu'));
}
add_action('init', 'register_theme_menus');
///new widget function
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description)));
}
create_widget('Top Left', 'top-left', 'portfolio category top-left');
create_widget('Top Middle', 'top-mid', 'portfolio category top-mid');
create_widget('Top Right', 'top-right', 'portfolio category top-right');
create_widget('Bottom Left', 'bot-left', 'portfolio category bot-left');
create_widget('Bottom Middle', 'bot-mid', 'portfolio category bot-mid');
create_widget('Bottom Right', 'bot-right', 'portfolio category bot-right');
///function that adds the logo uploader
function themeslug_theme_customizer($wp_customize)
{
$wp_customize->add_section('themeslug_logo_section', array('title' => __('Logo', 'themeslug'), 'priority' => 30, 'description' => 'Upload a logo to replace the default site name and description in the header'));
$wp_customize->add_setting('themeslug_logo');
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'themeslug_logo', array('label' => __('Logo', 'themeslug'), 'section' => 'themeslug_logo_section', 'settings' => 'themeslug_logo')));
}
add_action('customize_register', 'themeslug_theme_customizer');
///remove the admin toolbar code wordpress adds for some stupid incomprehensible reason fuck
show_admin_bar(false);
示例4: wp_enqueue_script
wp_enqueue_script('theme_js', theme_dir() . '/js/theme.js', ['jquery', 'bootstrap_js'], '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
//-------------
//Adding theme support
//-------------
//allows us to create a new header menu on the backend that will also show on the frontend
add_theme_support('menus');
//allows us to create custom post types that lets us dynamically populate posts w images
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(['header-menu' => __('Header Menu'), 'landing' => __('Landing Sub Menu'), 'about' => __('About Sub Menu'), 'contact' => __('Contact Sub Menu'), 'solutions' => __('Solutions Sub Menu'), 'products' => __('Products Sub Menu'), 'footer-menu' => __('Footer Menu')]);
}
add_action('init', 'register_ s');
//-------------
//creting/registering a sidebar widget
//------------
function create_widget($name, $id, $description)
{
$widget_options = ['name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'];
register_sidebar($widget_options);
}
create_widget('Front Page Left', 'front-left', 'Displays on left of hompage');
create_widget('Front Page Center', 'front-center', 'Displays on center of hompage');
create_widget('Front Page Right', 'front-right', 'Displays on right of hompage');
create_widget('Page Sidebar', 'page', 'Displays on pages w sidebar');
create_widget('Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section');
create_widget('Company-Description', 'company-desc', 'Wall of Text');
create_widget('Company-Contact', 'company-address', 'Phone-Email');
示例5: add_theme_support
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Header Menu')));
}
add_action('init', 'register_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front-left', 'Displays on the left of the homepage');
create_widget('Front Page Center', 'front-center', 'Displays in the center of the homepage');
create_widget('Front Page Right', 'front-right', 'Displays on the right of the homepage');
create_widget('Page Sidebar', 'page', 'Displays on the side of pages with a sidebar');
create_widget('Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section');
create_widget('Goat Gallery', 'goat_gal', 'Displays on Single Goat page, under main image');
add_image_size('caprathumb', 288, 9999);
/**
* Filter the excerpt "read more" string.
*
* @param string $more "Read more" excerpt string.
* @return string (Maybe) modified "read more" excerpt string.
*/
function wpdocs_excerpt_more($more)
{
return ' ...';
}
add_filter('excerpt_more', 'wpdocs_excerpt_more');
// add_filter('pre_get_posts', 'query_post_type');
// function query_post_type($query) {
// if(is_category() || is_tag()) {
示例6: our_theme_menus
function our_theme_menus()
{
register_nav_menus(array('header-menu' => __('Menu Principal')));
}
add_action('init', 'our_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
//Imagen Destacada
if (function_exists('add_theme_support')) {
add_theme_support('post-thumbnails');
//add_image_size( 'post-thumbnail', 1020, 280, true );
}
create_widget('Portada Izq', 'frontleft', 'Se muestra en el lado izquierdo');
create_widget('Portada Cent', 'frontcent', 'Se muestra en el lado cen');
create_widget('Portada Der', 'frontright', 'Se muestra en el lado der');
create_widget('Sidebar', 'sidebar', 'Se muestra en el lado derecho de una página');
create_widget('Sidebar Blog', 'blog', 'Se muestra en el lado derecho del blog');
// Numeric Page Navi (built into the theme by default)
function my_page_navi()
{
global $wp_query;
$bignum = 999999999;
if ($wp_query->max_num_pages <= 1) {
return;
}
echo '<nav class="pagination">';
echo paginate_links(array('base' => str_replace($bignum, '%#%', esc_url(get_pagenum_link($bignum))), 'format' => '', 'current' => max(1, get_query_var('paged')), 'total' => $wp_query->max_num_pages, 'prev_text' => '←', 'next_text' => '→', 'type' => 'list', 'end_size' => 3, 'mid_size' => 3));
echo '</nav>';
}
示例7: wp_enqueue_script
//wp_enqueue_script('leaflet_js',get_template_directory_uri().'/js/libraries/leaflet/leaflet.js','','',true);
// wp_enqueue_script('leaflet_js','http://cdn.leafletjs.com/leaflet/v0.7.7/leaflet.js','','',true);
wp_enqueue_script('cartodb_js', 'http://libs.cartocdn.com/cartodb.js/v3/3.15/cartodb.js', '', '', true);
wp_enqueue_script('map_js', get_template_directory_uri() . '/js/map-new.js', array('jquery', 'd3_js', 'd3_geo_js', 'topojson_js', 'cartodb_js'), '', true);
wp_enqueue_script('front_map_js', get_template_directory_uri() . '/js/front-map.js', array('jquery', 'd3_js', 'd3_geo_js', 'topojson_js', 'leaflet_js'), '', true);
wp_enqueue_script('menu_js', get_template_directory_uri() . '/js/libraries/menu.js', array('jquery'), '', true);
wp_enqueue_script('scroll_js', get_template_directory_uri() . '/js/scroll.js', array('jquery'), '', true);
wp_enqueue_script('carousel_js', get_template_directory_uri() . '/js/carousel.js', array('jquery', 'bootstrap_js'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_filter('show_admin_bar', '__return_false');
add_theme_support('menus');
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Header Menu')));
}
add_action('init', 'register_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front-left', 'Displays on the left of the homepage');
create_widget('Front Page Center', 'front-center', 'Displays on the center of the homepage');
create_widget('Front Page Right', 'front-right', 'Displays on the right of the homepage');
create_widget('Front Page Icons', 'front-icons', 'Displays the icons of the homepage');
create_widget('Front Page Nav', 'front-nav', 'Displays on the nav of the homepage');
create_widget('Page Sidebar', 'page', 'Displays on the pages with a call to sidebar');
create_widget('Blog Sidebar', 'blog', 'Displays on the blog with a call to sidebar');
create_widget('Front Page Sidebar', 'front', 'Displays on the front page with a call to sidebar');
示例8: add_theme_support
add_theme_support('post-formats', array('image', 'quote'));
add_theme_support('html5');
// Load Theme CSS
function theme_styles()
{
wp_enqueue_style('bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'theme_styles');
// Load Theme JS
function theme_js()
{
wp_enqueue_script('bootstrap_js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '', true);
wp_enqueue_script('theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'bootstrap_js'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
// Create a custom menus
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Main Menu')));
}
add_action('init', 'register_theme_menus');
// Function for creating Widegets
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
// Create widgets
create_widget("Primary Sidebar", "primary", "Displays on the side of most pages");
create_widget("Blog Sidebar", "blog", "Displays on the side of the blog section");
示例9: wp_enqueue_script
$wp_scripts->add_data('respond_js', 'conditional', 'lt IE9');
wp_enqueue_script('bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_theme_support('menus');
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Header Menu')));
}
add_action('init', 'register_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front-left', 'Displays widgets on the left of the front page');
create_widget('Front Page Center', 'front-center', 'Displays widgets in the center of the front page');
create_widget('Front Page Right', 'front-right', 'Displays widgets on the right of the front page');
create_widget('Page Sidebar', 'page', 'Displays widgets in the sidebar of a page');
create_widget('Blog Sidebar', 'blog', 'Displays widgets in the sidebar of a blog');
/**
* Remove the text - 'You may use these <abbr title="HyperText Markup
* Language">HTML</abbr> tags ...'
* from below the comment entry box.
*/
add_filter('comment_form_defaults', 'remove_comment_styling_prompt');
function remove_comment_styling_prompt($defaults)
{
$defaults['comment_notes_after'] = '';
return $defaults;
}
示例10: create_widget
<?php
//Generate Widgets
function create_widget($name, $id, $description)
{
$args = array('name' => $name, 'id' => $id, 'description' => $description, 'before_widget' => "", 'after_widget' => "", 'before_title' => '<h2>', 'after_title' => '</h2>');
register_sidebar($args);
}
create_widget('Bottom Right', 'bottom-right', 'This is the bottom right widget area.');
示例11: esc_attr
echo esc_attr($text_color);
?>
;
}
<?php
if (display_header_text() != true) {
?>
.site-title {
display: none;
}
<?php
}
?>
</style>
<?php
}
// Function creates widgets
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
// Register widgets here with parameters for create_widget function
create_widget('Blog Categories', 'blog-categories', 'Displays on the right inside the footer');
// Loads theme CSS files. Add additional CSS files here.
function theme_styles()
{
wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'theme_styles');
示例12: add_action
}
add_action('init', 'register_theme_menus');
// Custom Taxonomy Code
add_action('init', 'build_taxonomies', 0);
function build_taxonomies()
{
register_taxonomy('wine type', 'wine', array('hierarchical' => true, 'label' => 'Wine Type', 'query_var' => true, 'rewrite' => true));
}
add_role('basic_contributor', 'Basic Contributor', array('read' => true, 'edit_post' => true, 'delete_posts' => true));
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front_left', 'Display on the left of homepage');
create_widget('Front Page Right', 'front_right', 'Display on the right of homepage');
create_widget('Front Page Center', 'front_center', 'Display on the center of homepage ');
function excerpt_length_trim($length)
{
return 100;
}
add_filter('excerpt_length', 'excerpt_length_trim', 999);
function new_excerpt_more($more)
{
return ' <a class="read-more" href="' . get_permalink(get_the_ID()) . '">' . __('Read More', 'your-text-domain') . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
function remove_metaboxes()
{
remove_meta_box('custom field', 'movie', 'normal');
}
add_action('admin_menu', 'remove_metaboxes');
示例13: add_action
}
add_action('wp_enqueue_scripts', 'theme_styles');
function theme_js()
{
global $wp_scripts;
wp_register_script('html5_shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', '', '', false);
wp_register_script('respond_shiv', 'https://oss.maxcdn.com/respond/1.4.2/respond.min.js', '', '', false);
$wp_scripts->add_data('html5_shiv', 'conditional', 'lt IE 9');
$wp_scripts->add_data('respond_shiv', 'conditional', 'lt IE 9');
wp_enqueue_script('bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);
wp_enqueue_script('theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'bootstrap_js'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
//add_filter('show_admin_bar', '__return_false');
add_theme_support('menus');
add_theme_support('post-thumbnails');
function register_theme_menus()
{
register_nav_menus(array('header-menu' => __('Header Menu')));
}
add_action('init', 'register_theme_menus');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Front Page Left', 'front-left', 'Displays on the left of the homepage');
create_widget('Front Page Center', 'front-center', 'Displays in the center of the homepage');
create_widget('Front Page Right', 'front-right', 'Displays on the right of the homepage');
create_widget('Page Sidebar', 'page', 'Displays on the side of pages with a sidebar.');
create_widget('Blog Sidebar', 'blog', 'Displays on the side of blog page with a sidebar.');
示例14: add_action
width: 100% !important;
max-width: 800px !important;
padding: 30px 0 0;
}
body.login{
background-color: #E8F9FC!important;
font-size: 16px!important;
height: auto!important;
}
</style>
<?php
}
add_action('login_head', 'my_login_style');
//Link Excerpt to post
function new_excerpt_more($more)
{
return ' <a class="read-more" href="' . get_permalink(get_the_ID()) . '">' . __('...more <i class="fa fa-angle-double-right"></i>', 'your-text-domain') . '</a>';
}
add_filter('excerpt_more', 'new_excerpt_more');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
create_widget('Page Sidebar', 'page', 'Displays on the side of pages with a sidebar');
create_widget('Page with Left Sidebar', 'leftpage', 'Displays on the left side of pages with a sidebar');
create_widget('Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section');
create_widget('Header Menu 2', 'header-nav2', 'Displays on the right side of header');
create_widget('Header Widget', 'header-widget', 'Displays to the right of header menu 2');
create_widget('Header Widget 2', 'header-widget2', 'Displays to the right of Header Widget');
示例15: add_theme_support
<?php
add_theme_support('menus');
add_theme_support('post-thumbnails');
function create_widget($name, $id, $description)
{
register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2', 'after_title' => '</h2>'));
}
create_widget("portfolio-left", "port-left", "portfolio left sidebar");
function register_theme_menus()
{
register_nav_menus(array('portfolio-menu' => __('Portfolio'), 'main-menu' => __('Main Menu'), 'port-menu' => __('Port')));
}
add_action('init', 'register_theme_menus');
function wp_theme_styles()
{
wp_enqueue_style('normalize_css', get_template_directory_uri() . '/css/normalize.css');
wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
}
add_action('wp_enqueue_scripts', 'wp_theme_styles');
function wp_theme_js()
{
wp_enqueue_script('main_js', get_template_directory_uri() . '/js/app.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'wp_theme_js');