WordPress建站教程:给主题添加后台上传网站LOGO的功能

前端之家收集整理的这篇文章主要介绍了WordPress建站教程:给主题添加后台上传网站LOGO的功能前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我们在使用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-button-icon">
Crayon-language">PHP
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
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 Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-2">2
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-4">4
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-6">6
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-8">8
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-10">10
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-12">12
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-14">14
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-15">15
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-16">16
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-17">17
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-18">18
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-19">19
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-20">20
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-21">21
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-22">22
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-23">23
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-24">24
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-25">25
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-26">26
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-27">27
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-28">28
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-29">29
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-30">30
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-31">31
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-32">32
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-33">33
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-34">34
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-35">35
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-36">36
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-37">37
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-38">38
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-39">39
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-40">40
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-41">41
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-42">42
Crayon-num" data-line="Crayon-5c891d2395fbc738609302-43">43
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fbc738609302-44">44
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d2395fbc738609302-1">Crayon-t">classCrayon-h"> Crayon-e">ClassicOptionsCrayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-2">Crayon-h">Crayon-t">functionCrayon-h"> Crayon-e">getOptionsCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-3">Crayon-h">Crayon-v">$optionsCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">get_optionCrayon-sy">(Crayon-s">'classic_options'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-4">Crayon-h">Crayon-st">ifCrayon-h"> Crayon-sy">(Crayon-o">!Crayon-e">is_arrayCrayon-sy">(Crayon-v">$optionsCrayon-sy">)Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-5">Crayon-h">Crayon-v">$optionsCrayon-sy">[Crayon-s">'ashu_logo'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-s">''Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-6">Crayon-h">Crayon-e">update_optionCrayon-sy">(Crayon-s">'classic_options'Crayon-sy">,Crayon-h"> Crayon-v">$optionsCrayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-7">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-8">Crayon-h">Crayon-k ">returnCrayon-h"> Crayon-v">$optionsCrayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-9">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-10">Crayon-h">Crayon-t">functionCrayon-h"> Crayon-e">initCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-11">Crayon-h">Crayon-st">ifCrayon-sy">(Crayon-k ">issetCrayon-sy">(Crayon-v">$_POSTCrayon-sy">[Crayon-s">'classic_save'Crayon-sy">]Crayon-sy">)Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-12">Crayon-h">Crayon-v">$optionsCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">ClassicOptions::Crayon-e">getOptionsCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-13">Crayon-h">Crayon-v">$optionsCrayon-sy">[Crayon-s">'ashu_logo'Crayon-sy">]Crayon-h"> Crayon-o">=Crayon-h"> Crayon-e">stripslashesCrayon-sy">(Crayon-v">$_POSTCrayon-sy">[Crayon-s">'ashu_logo'Crayon-sy">]Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-14">Crayon-h">Crayon-e">update_optionCrayon-sy">(Crayon-s">'classic_options'Crayon-sy">,Crayon-h"> Crayon-v">$optionsCrayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-15">Crayon-h">Crayon-sy">}Crayon-h"> Crayon-st">elseCrayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-16">Crayon-h">Crayon-e">ClassicOptions::Crayon-e">getOptionsCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-17">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-18">Crayon-h">Crayon-e">add_theme_pageCrayon-sy">(Crayon-s">"主题设置"Crayon-sy">,Crayon-h"> Crayon-s">"主题设置"Crayon-sy">,Crayon-h"> Crayon-s">'edit_themes'Crayon-sy">,Crayon-h"> Crayon-e">basenameCrayon-sy">(Crayon-k ">__FILE__Crayon-sy">)Crayon-sy">,Crayon-h"> Crayon-t">arrayCrayon-sy">(Crayon-s">'ClassicOptions'Crayon-sy">,Crayon-h"> Crayon-s">'display'Crayon-sy">)Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-19">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-20">Crayon-h">Crayon-t">functionCrayon-h"> Crayon-e">displayCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-21">Crayon-h">Crayon-v">$optionsCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">ClassicOptions::Crayon-e">getOptionsCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-h"> Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-22">Crayon-h">Crayon-o"><Crayon-e">form Crayon-i">methodCrayon-o">=Crayon-s">"post"Crayon-h"> Crayon-i">enctypeCrayon-o">=Crayon-s">"multipart/form-data"Crayon-h"> Crayon-i">nameCrayon-o">=Crayon-s">"classic_form"Crayon-h"> Crayon-i">idCrayon-o">=Crayon-s">"classic_form"Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-23">Crayon-h">Crayon-o"><Crayon-e">div Crayon-t">classCrayon-o">=Crayon-s">"wrap"Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-24">Crayon-h">Crayon-o"><Crayon-e">h2Crayon-ta">PHPCrayon-h"> Crayon-e">_eCrayon-sy">(Crayon-s">'主题设置'Crayon-sy">)Crayon-sy">;Crayon-h"> Crayon-o"><Crayon-o">/Crayon-i">h2Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-25">Crayon-h">Crayon-o"><Crayon-i">pCrayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-26">Crayon-h">Crayon-o"><Crayon-i">labelCrayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-27">Crayon-h">Crayon-o"><Crayon-e">input Crayon-i">typeCrayon-o">=Crayon-s">"text"Crayon-h"> Crayon-i">sizeCrayon-o">=Crayon-s">"80"Crayon-h">Crayon-i">nameCrayon-o">=Crayon-s">"ashu_logo"Crayon-h"> Crayon-i">idCrayon-o">=Crayon-s">"ashu_logo"Crayon-h"> Crayon-i">valueCrayon-o">=Crayon-s">"Crayon-ta">PHPCrayon-h"> Crayon-k ">echoCrayon-sy">(Crayon-v">$optionsCrayon-sy">[Crayon-s">'ashu_logo'Crayon-sy">]Crayon-sy">)Crayon-sy">;Crayon-h"> "Crayon-o">/Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-28">Crayon-h">Crayon-o"><Crayon-e">input Crayon-i">typeCrayon-o">=Crayon-s">"button"Crayon-h"> Crayon-i">nameCrayon-o">=Crayon-s">"upload_button"Crayon-h"> Crayon-i">valueCrayon-o">=Crayon-s">"上传"Crayon-h"> Crayon-i">idCrayon-o">=Crayon-s">"upbottom"Crayon-o">/Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-29">Crayon-h">Crayon-o"><Crayon-o">/Crayon-i">labelCrayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-30">Crayon-h">Crayon-o"><Crayon-o">/Crayon-i">pCrayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-31">Crayon-h">Crayon-o"><Crayon-i">pCrayon-h"> Crayon-t">classCrayon-o">=Crayon-s">"submit"Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-32">Crayon-h">Crayon-o"><Crayon-e">input Crayon-i">typeCrayon-o">=Crayon-s">"submit"Crayon-h"> Crayon-i">nameCrayon-o">=Crayon-s">"classic_save"Crayon-h"> Crayon-i">valueCrayon-o">=Crayon-s">"Crayon-ta">PHPCrayon-h"> Crayon-e">_eCrayon-sy">(Crayon-s">'保存设置'Crayon-sy">)Crayon-sy">;Crayon-h"> "Crayon-h"> Crayon-o">/Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-33">Crayon-h">Crayon-o"><Crayon-o">/Crayon-i">pCrayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-34">Crayon-h">Crayon-o"><Crayon-o">/Crayon-i">divCrayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-35">Crayon-o"><Crayon-o">/Crayon-i">formCrayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-36">Crayon-ta">PHPCrayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-37">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-38">Crayon-sy">}Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-39">Crayon-e">add_actionCrayon-sy">(Crayon-s">'admin_menu'Crayon-sy">,Crayon-h"> Crayon-s">'init'Crayon-sy">)Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-40">Crayon-e">wp_enqueue_scriptCrayon-sy">(Crayon-s">'my-upload'Crayon-sy">,Crayon-h"> Crayon-e">get_bloginfoCrayon-sy">(Crayon-h"> Crayon-s">'stylesheet_directory'Crayon-h"> Crayon-sy">)Crayon-h"> Crayon-sy">.Crayon-h"> Crayon-s">'/js/upload.js'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-41">Crayon-c">//加载上传图片的js(wp自带)
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-42">Crayon-e">wp_enqueue_scriptCrayon-sy">(Crayon-s">'thickBox'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fbc738609302-43">Crayon-c">//加载css(wp自带)
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fbc738609302-44">Crayon-e">wp_enqueue_styleCrayon-sy">(Crayon-s">'thickBox'Crayon-sy">)Crayon-sy">;Crayon-h">

2. 新建upload.js,放入主题的js文件夹中,主题中没有js文件夹请新建,添加如下代码

Crayon-5c891d2395fc8218797446" 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">
Crayon-tools" style="font-size: 12px !important;height: 18px !important; line-height: 18px !important;">
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-button-icon">
Crayon-language">JavaScript
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
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 Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-2">2
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-4">4
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-5">5
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-6">6
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-7">7
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-8">8
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-9">9
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-10">10
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-11">11
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-12">12
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-13">13
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-14">14
Crayon-num" data-line="Crayon-5c891d2395fc8218797446-15">15
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fc8218797446-16">16
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d2395fc8218797446-1">Crayon-e">jQueryCrayon-sy">(Crayon-r">documentCrayon-sy">)Crayon-sy">.Crayon-e">readyCrayon-sy">(Crayon-t">functionCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-2">Crayon-h">Crayon-c">//upbottom为上传按钮的id
Crayon-line" id="Crayon-5c891d2395fc8218797446-3">Crayon-h">Crayon-e">jQueryCrayon-sy">(Crayon-s">'#upbottom'Crayon-sy">)Crayon-sy">.Crayon-e">clickCrayon-sy">(Crayon-t">functionCrayon-sy">(Crayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-4">Crayon-h">Crayon-c">//ashu_logo为文本域
Crayon-line" id="Crayon-5c891d2395fc8218797446-5">Crayon-h"> Crayon-v">targetfieldCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">jQueryCrayon-sy">(Crayon-r">thisCrayon-sy">)Crayon-sy">.Crayon-e">prevCrayon-sy">(Crayon-s">'#ashu_logo'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-6">Crayon-h"> Crayon-e">tb_showCrayon-sy">(Crayon-s">''Crayon-sy">,Crayon-h"> Crayon-s">'media-upload.PHP?type=image&amp;TB_iframe=true'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fc8218797446-7">Crayon-h"> Crayon-st">returnCrayon-h"> Crayon-t">falseCrayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-8">Crayon-h">Crayon-sy">}Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fc8218797446-9">Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-10">Crayon-h">Crayon-v">windowCrayon-sy">.Crayon-v">send_to_editorCrayon-h"> Crayon-o">=Crayon-h"> Crayon-t">functionCrayon-sy">(Crayon-v">htmlCrayon-sy">)Crayon-h"> Crayon-sy">{Crayon-h">
Crayon-line" id="Crayon-5c891d2395fc8218797446-11">Crayon-h"> Crayon-v">imgurlCrayon-h"> Crayon-o">=Crayon-h"> Crayon-e">jQueryCrayon-sy">(Crayon-s">'img'Crayon-sy">,Crayon-v">htmlCrayon-sy">)Crayon-sy">.Crayon-e">attrCrayon-sy">(Crayon-s">'src'Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-12">Crayon-h"> Crayon-e">jQueryCrayon-sy">(Crayon-v">targetfieldCrayon-sy">)Crayon-sy">.Crayon-e">valCrayon-sy">(Crayon-v">imgurlCrayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line" id="Crayon-5c891d2395fc8218797446-13">Crayon-h"> Crayon-e">tb_removeCrayon-sy">(Crayon-sy">)Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-14">Crayon-h">Crayon-sy">}Crayon-h">
Crayon-line" id="Crayon-5c891d2395fc8218797446-15">Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fc8218797446-16">Crayon-sy">}Crayon-sy">)Crayon-sy">;Crayon-h">

3. 在后台上传网站logo效果如下图:

upload-a-logo-0

upload-a-logo

4. 在前台显示logo,打开header.PHP,在需要显示的地方,添加如下代码

Crayon-5c891d2395fca141225115" 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">header.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-button-icon">
Crayon-language">PHP
Crayon-info" style="min-height: 16.8px !important; line-height: 16.8px !important;">
Crayon-plain-wrap">
Crayon-main" style="">Crayon-table">Crayon-row">
Crayon-nums " data-settings="show">
Crayon-nums-content" style="font-size: 12px !important; line-height: 15px !important;">
Crayon-num" data-line="Crayon-5c891d2395fca141225115-1">1
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fca141225115-2">2
Crayon-num" data-line="Crayon-5c891d2395fca141225115-3">3
Crayon-num Crayon-striped-num" data-line="Crayon-5c891d2395fca141225115-4">4
Crayon-num" data-line="Crayon-5c891d2395fca141225115-5">5
Crayon-code">
Crayon-pre" style="font-size: 12px !important; line-height: 15px !important; -moz-tab-size:4; -o-tab-size:4; -webkit-tab-size:4; tab-size:4;">
Crayon-line" id="Crayon-5c891d2395fca141225115-1">Crayon-ta">PHPCrayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fca141225115-2">Crayon-h"> Crayon-v">$logoCrayon-o">=Crayon-e">get_optionCrayon-sy">(Crayon-s">'classic_options'Crayon-sy">)Crayon-sy">;
Crayon-line" id="Crayon-5c891d2395fca141225115-3">Crayon-h"> Crayon-v">$logo_urlCrayon-o">=Crayon-v">$logoCrayon-sy">[Crayon-s">'ashu_logo'Crayon-sy">]Crayon-sy">;Crayon-h">
Crayon-line Crayon-striped-line" id="Crayon-5c891d2395fca141225115-4">
Crayon-line" id="Crayon-5c891d2395fca141225115-5">Crayon-o"><Crayon-e">img Crayon-i">srcCrayon-o">=Crayon-s">"Crayon-ta">PHPCrayon-h"> Crayon-k ">echoCrayon-h"> Crayon-v">$logo_urlCrayon-sy">;"Crayon-h"> Crayon-i">altCrayon-o">=Crayon-s">""Crayon-h"> Crayon-o">/

猜你在找的wordpress相关文章