我们在使用wordpress建设网站的时候,当网站需要频繁更换logo的时候,每次都登录FTP进行更换就有些太麻烦了,今天91wordpress特地为大家准备了一篇wordpress教程,教给大家如何让给主题添加后台上传网站logo的功能。
1. 切换到主题所在目录,打开functions.PHP文件,添加如下代码:
Crayon-5c891d2395fbc738609302" class="Crayon-Syntax Crayon-theme-classic Crayon-font-monaco Crayon-os-pc print-yes notranslate" data-settings=" minimize scroll-mouSEOver" style=" margin-top: 12px; margin-bottom: 12px; font-size: 12px !important; line-height: 15px !important;">
Crayon-toolbar" data-settings=" mouSEOver overlay hide delay" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-title">functions.PHP
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">Crayon-mixed-highlight" title="Contains Mixed Languages">
Crayon-button Crayon-nums-button" title="Toggle Line Numbers">
Crayon-button-icon">
Crayon-button Crayon-plain-button" title="Toggle Plain Code">
Crayon-button-icon">
Crayon-button Crayon-wrap-button" title="Toggle Line Wrap">
Crayon-button-icon">
Crayon-button Crayon-expand-button" title="Expand Code">
Crayon-button-icon">
Crayon-button Crayon-copy-button" title="Copy">
Crayon-button-icon">
Crayon-button Crayon-popup-button" title="Open Code In New Window">
Crayon-language">PHPCrayon-button-icon">
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
PHP
}
}
add_action('admin_menu','init'));
wp_enqueue_script('my-upload',get_bloginfo( 'stylesheet_directory' ) . '/js/upload.js');
//加载上传图片的js(wp自带)
wp_enqueue_script('thickBox');
//加载css(wp自带)
wp_enqueue_style('thickBox'); Crayon-main" style="">Crayon-table">
Crayon-nums " data-settings="show"> Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"> Crayon-num" data-line="Crayon-5c891d2395fbc738609302-1">1 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-3">3 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-5">5 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-7">7 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-9">9 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-11">11 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-13">13 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-15">15 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-17">17 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-19">19 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-21">21 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-23">23 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-25">25 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-27">27 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-29">29 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-31">31 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-33">33 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-35">35 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-37">37 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-39">39 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-41">41 Crayon-num" data-line="Crayon-5c891d2395fbc738609302-43">43 | Crayon-code">
Crayon-nums " data-settings="show"> Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;"> Crayon-num" data-line="Crayon-5c891d2395fc8218797446-1">1 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-3">3 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-5">5 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-7">7 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-9">9 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-11">11 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-13">13 Crayon-num" data-line="Crayon-5c891d2395fc8218797446-15">15 | Crayon-code">
Crayon-nums " data-settings="show"> | Crayon-code">