php olivor twist functions.php
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php olivor twist functions.php相关的知识,希望对你有一定的参考价值。
<?php
//* Start the engine
include_once( get_template_directory() . '/lib/init.php' );
//* Set Localization (do not remove)
load_child_theme_textdomain( 'olivortwist', apply_filters( 'child_theme_textdomain', get_stylesheet_directory() . '/languages', 'olivortwist' ) );
//* Child theme (do not remove)
define( 'CHILD_THEME_NAME', __( 'Olivor Twist', 'olivortwist' ) );
define( 'CHILD_THEME_URL', 'http://olivor-twist.com/' );
define( 'CHILD_THEME_VERSION', '2.0' );
//* Add HTML5 markup structure
add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list' ) );
//* Add viewport meta tag for mobile browsers
add_theme_support( 'genesis-responsive-viewport' );
//* Enqueue scripts
add_action( 'wp_enqueue_scripts', 'olivortwist_enqueue_scripts' );
function olivortwist_enqueue_scripts() {
wp_enqueue_script( 'olivortwist-responsive-menu', get_bloginfo( 'stylesheet_directory' ) . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
wp_enqueue_style( 'google-font-source-sans-pro', '//fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,700', array(), CHILD_THEME_VERSION );
//* Load Backstretch script and prepare images for loading
if ( ! genesis_get_option( 'olivortwist_default_image' ) && ! has_post_thumbnail() )
return;
wp_enqueue_script( 'olivortwist-backstretch', get_bloginfo( 'stylesheet_directory' ) . '/js/backstretch.js', array( 'jquery' ), '1.0.0', true );
wp_enqueue_script( 'olivortwist-backstretch-set', get_bloginfo('stylesheet_directory').'/js/backstretch-set.js' , array( 'jquery', 'olivortwist-backstretch' ), '1.0.0', true );
}
/** Add metabox for Olivor Twist default/fallback background image */
add_action( 'genesis_theme_settings_metaboxes', 'olivortwist_theme_settings_metaboxes', 10, 1 );
function olivortwist_theme_settings_metaboxes( $pagehook ) {
add_meta_box( 'olivortwist-default-background-image', __( 'Olivor Twist - Default Image', 'olivortwist' ), 'olivortwist_default_background_image_metabox', $pagehook, 'main', 'high' );
}
/** Content for the default/fallback image metabox */
function olivortwist_default_background_image_metabox() {
printf( '<label for="%s[%s]" /><br />', GENESIS_SETTINGS_FIELD, 'olivortwist_default_image' );
printf( '<input type="text" name="%1$s[%2$s]" id="%1$s[%1$s]" size="75" value="%3$s" />', GENESIS_SETTINGS_FIELD, 'olivortwist_default_image', genesis_get_option( 'olivortwist_default_image' ) );
}
add_action( 'genesis_after_entry', 'olivortwist_set_background_image' );
function olivortwist_set_background_image() {
$image = array( 'src' => has_post_thumbnail() ? genesis_get_image( array( 'format' => 'url' ) ) : genesis_get_option( 'olivortwist_default_image' ) );
wp_localize_script( 'olivortwist-backstretch-set', 'BackStretchImg', $image );
}
//* Unregister layout settings
genesis_unregister_layout( 'content-sidebar' );
genesis_unregister_layout( 'sidebar-content' );
genesis_unregister_layout( 'content-sidebar-sidebar' );
genesis_unregister_layout( 'sidebar-sidebar-content' );
genesis_unregister_layout( 'sidebar-content-sidebar' );
//* Unregister secondary navigation menu
add_theme_support( 'genesis-menus', array( 'primary' => __( 'Primary Navigation Menu', 'olivortwist' ) ) );
//* Unregister sidebars
// unregister_sidebar( 'sidebar' );
unregister_sidebar( 'sidebar-alt' );
//* Force full-width-content layout setting
add_filter( 'genesis_site_layout', '__genesis_return_full_width_content' );
//* Reposition the primary navigation menu
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_nav' );
//* Hook after content widget after the content-sidebar-wrap
add_action( 'genesis_after_content_sidebar_wrap', 'olivortwist_after_content' );
function olivortwist_after_content() {
genesis_widget_area( 'after-content', array(
'before' => '<div class="after-content" class="widget-area">',
'after' => '</div>',
) );
}
//* Modify the size of the Gravatar in the author box
add_filter( 'genesis_author_box_gravatar_size', 'olivortwist_author_box_gravatar_size' );
function olivortwist_author_box_gravatar_size( $size ) {
return '144';
}
//* Modify the size of the Gravatar in the entry comments
add_filter( 'genesis_comment_list_args', 'olivortwist_comments_gravatar' );
function olivortwist_comments_gravatar( $args ) {
$args['avatar_size'] = 112;
return $args;
}
//* Remove comment form allowed tags
add_filter( 'comment_form_defaults', 'olivortwist_remove_comment_form_allowed_tags' );
function olivortwist_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
//* Register widget areas
genesis_register_sidebar( array(
'id' => 'after-content',
'name' => __( 'After Content', 'olivortwist' ),
'description' => __( 'This is the widget that appears after the content.', 'olivortwist' ),
) );
// White label
// Custom login logo
add_action( 'login_enqueue_scripts', 'xmit_replace_login_logo' );
function xmit_replace_login_logo() {
?><style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri() ?>/images/logo-login.png) !important;
background-size: 80px 80px; /* Adjust to the dimensions of your logo. WP Default: 80px 80px */
padding-bottom: 15px; /* Useful for spacing your logo from the form below. Default: 15px*/
height: 80px;
width: 80px;
}
html, body {background: #9FA1A4 !important;}
.login #nav, .login #backtoblog {padding:0 !important;}
p#nav a, p#backtoblog a {color:white !important;}
.wp-core-ui .button-primary {background:#303236 !important;border-color:#000;}
.wp-core-ui .button-primary:hover {border-color:#fefefe !important;}
</style><?php
}
// Login Screen: Link login screen logo to site's homepage
function xmit_url_login(){
return get_bloginfo( 'wpurl' );
}
add_filter('login_headerurl', 'xmit_url_login');
// Login Screen: Change login logo hover text
function xmit_login_logo_url_title() {
return 'Click to return to the site homepage';
}
add_filter( 'login_headertitle', 'xmit_login_logo_url_title' );
// Login Screen: Set 'remember me' to be checked by default
function xmit_login_checked_remember_me() {
add_filter( 'login_footer', 'xmit_rememberme_checked' );
}
add_action( 'init', 'xmit_login_checked_remember_me' );
function xmit_rememberme_checked() {
echo "<script>document.getElementById('rememberme').checked = true;</script>";
}
// Login Screen: Don't inform user which piece of credential was incorrect
function xmit_failed_login () {
return 'The login information you have entered is incorrect. Please try again.';
}
add_filter ( 'login_errors', 'xmit_failed_login' );
// replace WordPress Howdy
function replace_howdy( $wp_admin_bar ) {
$my_account=$wp_admin_bar->get_node('my-account');
$newtitle = str_replace( 'Howdy,', 'You are logged in as', $my_account->title );
$wp_admin_bar->add_node( array(
'id' => 'my-account',
'title' => $newtitle,
) );
}
add_filter( 'admin_bar_menu', 'replace_howdy',25 );
// Modify the admin footer
function xmit_modify_footer_admin () {
echo '<span id="footer-thankyou">Theme Development by <a href="http://www.transmitstudio.com" target="_blank" rel="nofollow">Transmit Studio</a> · Cleveland | San Jose | Vancouver</span>';
}
add_filter('admin_footer_text', 'xmit_modify_footer_admin');
// Fix annoying admin menu bug for WooSlider v1.0.5 where menu image ghosts
add_action( 'admin_head', 'fix_menu_posts_slide_img' );
function fix_menu_posts_slide_img(){ ?>
<style>
#adminmenu #menu-posts-slide .wp-menu-image img {display: none;}
</style>
<?php
}
以上是关于php olivor twist functions.php的主要内容,如果未能解决你的问题,请参考以下文章
您如何通过 Python(而不是通过 Twisted)运行 Twisted 应用程序?
您如何通过Python(而不是通过Twisted)运行Twisted应用程序?