Skip to main content
We are Brand SEO Beijing serving international business, your marketing partner, Contact us by mi@mgsh.com.cn

Theme development example simple main page

Referring to this sample code, you can use Ashuwp_framework to create a setting page that can set logo and ico images.
demo logo-brand-SEO-public opinion-optimization-米国生活

import frame

Add the following code to the functinos.php file of the theme. There is no config.php configuration file in the downloaded framework. You need to create it yourself. Of course, the file name is optional.

//Load framework file require get_template_directory() . '/ashuwp_framework/ashuwp_framework_core.php'; //Configuration file require get_template_directory() . '/ashuwp_framework/config.php';

configuration code

In the config.php configuration file, add the following configuration code.

/**General options**/ $page_info = array( 'full_name' => 'General Options', //page title 'optionname' => 'general', //set the page save name, the whole page is only saved in the database A record. 'child' => false, //top page 'desc' => ' Ashuwp Framework ', 'filename' => 'generalpage' //page name, reflected in url admin.php?page=generalpage ); $ashu_options = array(); $ashu_options[] = array( 'name' => 'Logo', 'id' => 'ashuwp_logo', //id is unique 'desc' => 'Please Upload a image.', ' std' => '', 'type' => 'upload' //type is upload, it will be displayed as a file upload box); $ashu_options[] = array( 'name' => 'ICO', 'id' => ' ashuwp_ico', 'desc' => 'Please Upload a ico file.', 'std' => '', 'type' => 'upload' ); //Instantiate class $option_page = new ashuwp_options_feild($ashu_options, $ page_info);

Front-end code reference

Note: The code is for reference only.

call ico

The ico icon is generally in the head tag of a web page.

general, the name saved in the database is ashuwp_general //All data of the entire setting page is saved in a record in the database //$general_option gets an array/** $general_option structure is as follows array( 'ashuwp_logo' = > 'http://www.ashuwp.com/images/logo.png'; 'ashuwp_ico' => 'http://www.ashuwp.com/images/ashuwp_ico.png'; ) **/ $general_option = get_option ('ashuwp_general'); if( !empty($general_option['ashuwp_ico']) ){ ?> " type="image/x-icon" />
 Logo calling example
" />

Reprinted from: Theme making tutorial www.ashuwp.com

Back to Top