示例#1
0
{
    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
0
/**
*
* 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
0
    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 f**k
show_admin_bar(false);
    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
0
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
0
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' => '&larr;', 'next_text' => '&rarr;', 'type' => 'list', 'end_size' => 3, 'mid_size' => 3));
    echo '</nav>';
}
示例#7
0
    //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
0
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
0
    $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
0
<?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
0
    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
0
}
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
0
}
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
0
文件: functions.php 项目: carranl/tc
    	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
0
<?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');
示例#16
0
    return apply_filters('the_excerpt', $midtext);
}
function custom_field_excerpt_righthome()
{
    global $post;
    $rhome = get_field('right_column_home');
    if ('' != $rhome) {
        $rhome = strip_shortcodes($rhome);
        $rhome = apply_filters('the_content', $rhome);
        $rhome = str_replace(']]>', ']]>', $rhome);
        $excerpt_length = 100;
        // 20 words
        $excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
        $rhome = wp_trim_words($rhome, $excerpt_length, $excerpt_more);
    }
    return apply_filters('the_excerpt', $text);
}
//Menu Registar
function register_theme_menus()
{
    register_nav_menus(array('menu-1' => __('Menu 1'), 'menu-2' => __('Menu 2')));
}
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('Blog Sidebar', 'blog', 'Displays on the side of pages in the blog section');
create_widget('Header Widget', 'header-widget', 'Displays to the right of header menu 2');
create_widget('Footer Widget', 'footer-widget', 'Displays in the black portion of the footer');
示例#17
0
    wp_enqueue_style('main_css', get_template_directory_uri() . '/style.css');
}
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_js', '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/theme.js', array('jquery', 'bootstrap_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');
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('Page Sidebar', 'page', 'Displays on the sidebar of pages with sidebar');
create_widget('Blog Sidebar', 'blog', 'Displays on the sidebar of blog with sidebar');
示例#18
0
文件: functions.php 项目: ab75173/ISL
<?php

// Load Theme CSS
function theme_styles()
{
    wp_enqueue_style('main', get_template_directory_uri() . '/style.css');
    wp_enqueue_style('normalize', get_template_directory_uri() . '/css/normalize.css');
    wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.css');
}
// Load Theme JS
function theme_js()
{
    wp_enqueue_script('theme_js', get_template_directory_uri() . '/js/theme.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_action('wp_enqueue_scripts', 'theme_styles');
// Enable custom menus
add_theme_support('menus');
// Registe Sidebar Widgets
function create_widget($name, $id, $description)
{
    $args = array('name' => __($name), 'id' => $id, 'description' => $description, 'before_widget' => '', 'after_widget' => '</li>', 'before_title' => '<h2 class="widgettitle">', 'after_title' => '</h2>');
    register_sidebar($args);
}
create_widget('About Left', 'about_left', 'Displays the left column of the about page');
create_widget('About Right', 'about_right', 'Displays the right column of the about page');
create_widget('Left Footer', 'footer_left', 'Displays in the left area of the footer');
create_widget('Middle Footer', 'footer_middle', 'Displays in the middle area of the footer');
create_widget('Right Footer', 'footer_right', 'Displays in the right area of the footer');
示例#19
0
<?php

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('Home Page Left', 'home-page-left-pane', 'Display content for home page left pane.');
create_widget('Home Page Middle', 'home-page-middle-pane', 'Display content for home page middle pane.');
create_widget('Home Page Right', 'home-page-right-pane', 'Display content for home page right pane.');
create_widget('Blog Sidebar', 'blog-sidebar', 'Display categories and date of blog posts.');
示例#20
0
    wp_enqueue_style('style.css', get_template_directory_uri() . '/css/style.css');
}
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_js', '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.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_theme_support('menus');
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' => '<h2>', 'after_title' => '</h2>'));
}
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('Footer Left', 'footer-left', 'Left Side of Footer');
create_widget('Footer Right', 'footer-right', 'Right Side of Footer');
create_widget('Front Page Bottom Left', 'front-bottom-left', 'Lower left quadrant of the homepage');
create_widget('Front Page Bottom Right', 'front-bottom-right', 'Lower right quadrant of the homepage');
示例#21
0
//Register Menu
function register_theme_menus()
{
    register_nav_menus(array('main-menu' => __('Main Menu')));
}
//Remove WP admin bar
add_filter('show_admin_bar', '__return_false');
//Post thumbnails
add_theme_support('post-thumbnails');
//Image sizes
add_image_size('homepage-thumb', 800, 600, true);
add_image_size('hero', 2000);
//Sidebar --> Widget
function create_widget($name, $id, $description)
{
    $args = array('name' => __($name), 'id' => $id, 'description' => $description, 'before_widget' => '', 'after_widget' => '', 'before_title' => '<h3>', 'after_title' => '</h3>');
    register_sidebar($args);
}
create_widget('Dribbble Widget', "dribbble", "This widget will display your Dribbble shots!");
// //Search Form
// function my_search_form( $form ) {
//     $form = '<form role="search" method="get" id="searchform" class="searchform" action="' . home_url( '/' ) . '" >
//     <div><label class="screen-reader-text" for="s">' . __( 'Search for:' ) . '</label>
//     <input type="text" placeholder="&#xf002;' . get_search_query() . '" name="s" id="s" style="font-family:fontawesome;color:#222;" />
//     <input type="submit" id="searchsubmit" value="'. esc_attr__( 'Search' ) .'" />
//     </div>
//     </form>';
//     return $form;
// }
// add_filter( 'get_search_form', 'my_search_form' );
//
    wp_enqueue_style('bootstrap_css', get_template_directory_uri() . '/bootstrap/css/styles.css');
    wp_enqueue_style('print_css', get_template_directory_uri() . '/bootstrap/css/print.css');
}
add_action('wp_enqueue_scripts', 'theme_styles');
function theme_js()
{
    global $wp_scripts;
    wp_register_script('html5_shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js', '', '', false);
    wp_register_script('respond_js', 'https://oss.maxcdn.com/libs/respond.js/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() . '/bootstrap/js/bootstrap.min.js', array('jquery'), '', true);
}
add_action('wp_enqueue_scripts', 'theme_js');
add_theme_support('menus');
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>'));
}
// frontpage widgets
create_widget('Front Page Left', 'front-page-left', 'Display on the left of the homepage');
create_widget('Front Page middle', 'front-page-middle', 'Display on the middle of the homepage');
create_widget('Front Page right', 'front-page-right', 'Display on the right of the homepage');
// sidebar Widgets
create_widget('Sidebar Widgets', 'sidebar-widget', 'Display on the page sidebar');
示例#23
0
">
					<?php 
            printf('<label for="%1$s">%2$s<br /><input type="text" id="%1$s" class="widefat %1$s" name="%3$s" value="%4$s" /></label>', esc_attr($id), esc_html($label), esc_attr($name), esc_attr($value));
            ?>
				</p>
			<?php 
        }
    }
    /**
     * Add our fields to the screen options toggle
     *
     * @param array $columns Menu item columns
     * @return array
     */
    public static function _columns($columns)
    {
        $columns = array_merge($columns, self::$fields);
        return $columns;
    }
}
Menu_Item_Custom_Fields_Example::init();
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 page sidebar');
create_widget('Blog sidebar', 'blog', 'Displays on the page with blog layout');
示例#24
0
<?php

// Create a custom menus
function register_my_menus()
{
    register_nav_menus(array('footer-menu' => __('Footer Menu')));
}
add_action('init', 'register_my_menus');
// Function for creating Widegets
function create_widget($name, $id, $description)
{
    register_sidebar(array('name' => __($name), 'id' => $id, 'description' => __($description), 'before_widget' => '<div id="' . $id . '" class="widget %1$s %2$s">', 'after_widget' => '</div>', 'before_title' => '<h3>', 'after_title' => '</h3>'));
}
// Create the actual widgets
create_widget("Header", "uptop", "Displays in the header of the site, above the title");
示例#25
0
    wp_enqueue_script('easyzoom_js', get_template_directory_uri() . '/js/easyzoom.js', array('jquery'), '', true);
    wp_enqueue_script('main_js', get_template_directory_uri() . '/js/main.js', array('jquery'), '', 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', 'Display on the left of the homepage');
function paginate_category($total_posts)
{
    $total_page = ($total_posts - 1) / 6 + 1;
    for ($i = 1; $i <= $total_page; $i++) {
        echo "<a class=\"page-numbers\" href=\"/news/page/" . $i . "\">" . $i . "</a>";
        echo "\n";
    }
}
add_filter('post_thumbnail_html', 'remove_thumbnail_dimensions', 10, 3);
function remove_thumbnail_dimensions($html, $post_id, $post_image_id)
{
    $html = preg_replace('/(width|height)=\\"\\d*\\"\\s/', "", $html);
    return $html;
}
示例#26
0
    $wp_scripts->add_data('respond_js', 'conditional', 'lt IE 9');
    wp_enqueue_script('bootstrap_js', theme_dir() . '/js/bootstrap.min.js', ['jquery'], '', true);
    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')]);
}
add_action('init', 'register_theme_menus');
//-------------
//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');
示例#27
0
    wp_enqueue_script('bootstrap_js', theme_dir() . '/js/bootstrap.min.js', ['jquery'], '', true);
    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')]);
}
add_action('init', 'register_theme_menus');
//-------------
//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');
示例#28
0
<?php

namespace SandersForPresident\Wordpress\Init;

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');
示例#29
0
文件: functions.php 项目: blehr/mine
 *
 * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
 */
function mine_widgets_init()
{
    register_sidebar(array('name' => esc_html__('Sidebar', 'mine'), 'id' => 'sidebar-1', 'description' => '', 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
}
add_action('widgets_init', 'mine_widgets_init');
function create_widget($name, $id, $description)
{
    register_sidebar(array('name' => $name, 'id' => $id, 'description' => $description, 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 'after_widget' => '</aside>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'));
}
create_widget(__('Header', 'mine'), 'header', __('Displays in the Header', 'mine'));
create_widget(__('Footer Left', 'mine'), 'footer-left', __('Displays on the left of the Footer', 'mine'));
create_widget(__('Footer Center', 'mine'), 'footer-center', __('Displays in the center of the Footer', 'mine'));
create_widget(__('Footer Right', 'mine'), 'footer-right', __('Displays on the right of the Footer', 'mine'));
/**
 * Enqueue scripts and styles.
 */
function mine_scripts()
{
    wp_enqueue_style('mine_bootstrap_css', get_template_directory_uri() . '/css/bootstrap.css');
    wp_enqueue_style('mine_font_awesome_css', get_template_directory_uri() . '/font-awesome/css/font-awesome.css');
    wp_enqueue_style('bpl_googlefont_css', '//fonts.googleapis.com/css?family=Open+Sans:400,400italic,700,800|Roboto+Slab:400,700');
    wp_enqueue_style('mine-style', get_stylesheet_uri());
    wp_enqueue_script('mine_bootstrap_js', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'), '', true);
    wp_enqueue_script('mine_theme-js', get_template_directory_uri() . '/js/theme.js', array('jquery', 'mine_bootstrap_js'), '', true);
    wp_enqueue_script('mine-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true);
    if (is_singular() && comments_open() && get_option('thread_comments')) {
        wp_enqueue_script('comment-reply');
    }