Tsela ea ho kenya WordPress / sehlooho sa template / mosebetsi oa setšoantšo o letsetsa Daquan

Morao tjena, nakong ea liphetoho tse ling tsa sehlooho, litšoantšo tse ling, CSS, JS le lifaele tse ling tse tsitsitseng li atisa ho bitsoa.

  • Ha e le hantle, bakeng sa lifaele tsena tse tsitsitseng, re ka li bitsa ka ho toba re sebelisa litsela tse feletseng.
  • Empa nahana ka lintlha tse latelanghaha sebaka sa marang-rangTeko, le letoto la mathata a khoutu ao sehlooho se ka bang le ona, joalo ka khoutu e sa sebetseng ka lebaka la liphetoho tse sa reroang.
  • Chen Weiliangke ntse ke rata ho sebelisaWordpressMosebetsi oa tsela, le tsela e lekanyelitsoeng bakeng sa ho kenya lisebelisoa.

Hobane boko ba motho bo thata ho hopola khoutu e rarahaneng ea mosebetsi oa WordPress, re atisa ho lebala hore na ke khoutu efe ea mosebetsi oa WordPress eo re ka e sebelisang ha re hloka ho e sebelisa?

Kahoo, ke nkile qeto ea ho thathamisa mehala ea ts'ebetso ea WordPress mona le ho e ntlafatsa nako le nako bakeng sa ho bua.

Letšoao la WordPress

Mokhoa oa leqephe la maqephe a WordPress

<?php home_url( $path, $scheme ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo home_url(); ?>
  • Hlahisa: http:// domain name ea hau

Mokhoa oa ho kenya WordPress

<?php site_url( $path, $scheme ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo site_url(); ?>
  • Hlahisa: http://yourdomain/wordpress

WordPress backendtsela ea tsamaiso

<?php admin_url( $path, $scheme ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo admin_url(); ?>
  • Hlahisa: http://yourdomain/wordpress/wp-admin/

wp-e kenyelletsa tsela

<?php includes_url( $path ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo includes_url(); ?>
  • Hlahisa: http://yourdomain/wordpress/wp-includes/

tsela ea litaba tsa wp

<?php content_url( $path ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo content_url(); ?>
  • Hlahisa: http://yourdomain/wordpress/wp-content

Mokhoa oa ho kenya WordPress

<?php wp_upload_dir( string $time = null, bool $create_dir = true,bool $refresh_cache = false ) ?>

Pitso ea mosebetsi oa PHP ▼

<?php $upload_dir = wp_upload_dir(); echo $upload_dir['baseurl']; ?>
  • Hlahisa: http://yourdomain/wordpress/wp-content/uploads

Pitso ea mosebetsi oa PHP ▼

<?php $upload_dir = wp_upload_dir(); echo $upload_dir['url']; ?>
  • Hlahisa: http://yourdomain/wordpress/wp-content/uploads/2018/01

Mokhoa oa ho letsetsa oa PHP ▼

<?php $upload_dir = wp_upload_dir(); echo $upload_dir['basedir']; ?>
  • Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/uploads

Mokhoa oa ho letsetsa oa PHP ▼

<?php $upload_dir = wp_upload_dir(); echo $upload_dir['path']; ?>
  • Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/uploads/2018/01

WordPress plugintsela

<?php plugins_url( $path, $plugin ); ?>

Pitso ea mosebetsi oa PHP ▼

<?php echo plugins_url(); ?>
  • Hlahisa: http://yourdomain/wordpress/wp-content/plugins

Pitso ea mosebetsi oa PHP ▼

<?php plugin_dir_url($file) ?>
  • Tse sebelisoang hangata:      //$file (e hlokehang) e khutlisa tsela e felletseng ea plugin ea hajoale
  • Hlahisa: http://yourdomain/wordpress/wp-content/plugins/yourplugin/

Pitso ea mosebetsi oa PHP ▼

<?php plugin_dir_path($file); ?>
  • Tse sebelisoang hangata:      //$file (e hlokehang) e khutlisa tsela e felletseng ea seva ea hona joale ea plugin.
  • Ho e beha tlas'a faele ea sehlooho ho tla boela ho khutlisetse tsela e feletseng ea seva sa sehlooho, empa ha e khothalletsoe ho e sebelisa, ho bonolo ho e senya.
  • Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress\wp-content\plugins\yourplugin/

Mokhoa oa sehlooho oa WordPress

<?php get_theme_roots(); ?>

Tse sebelisoang hangata:

bonts'a: /themes

<?php get_theme_root( '$stylesheet_or_template' ); ?>

Tse sebelisoang hangata:

Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/themes

<?php get_theme_root_uri(); ?>

Tse sebelisoang hangata:

Bontša: http://yourdomain.com/wordpress/wp-content/themes

<?php get_theme_file_uri( '$file' ) ?>

Tse sebelisoang hangata:

Hlahisa: http://yourdomain.com/wordpress/wp-content/themes/cwlcms

<?php get_theme_file_path( '$file' ) ?>

Tse sebelisoang hangata:

Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/themes/cwlcms

<?php get_template(); ?>

Tse sebelisoang hangata: //busetsa lebitso la sehlooho

Pontšo: cwlcms

<?php get_template_directory(); ?>

Tse sebelisoang hangata:

Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/themes/cwlcms

<?php get_template_directory_uri(); ?>

Tse sebelisoang hangata:

Hlahisa: http://yourdomain.com/wordpress/wp-content/themes/cwlcms

Tlhokomeliso: get_template e botsa faele ea style.css ea theme. Haeba ho se na faele e joalo bukeng ea theme, phoso e tla etsahala.

<?php get_stylesheet(); ?>

Tse sebelisoang hangata: // Haeba u sebelisa sehlooho-tlase, khutlisetsa lebitso la bukana ea sehloohoana

Pontšo: cwlcms

<?php get_stylesheet_uri(); ?>

Tse sebelisoang hangata:

Hlahisa: http://yourdomain.com/wordpress/wp-content/themes/cwlcms/style.css

<?php get_stylesheet_directory() ?>

Tse sebelisoang hangata:

  • // Haeba u sebelisa sehlooho se senyenyane, khutlisetsa tsela ea seva ea sub-theme

Hlahisa: D:\WorkingSoftWare\phpStudy\WWW\wordpress/wp-content/themes/cwlcms

  • // Empa e sebelisoa haholoanyane ho kenyelletsa lifaele tse ling
<?php get_stylesheet_directory_uri(); ?>

Tse sebelisoang hangata:

Hlahisa: http://yourdomain.com/wordpress/wp-content/themes/cwlcms

Tlhokomeliso: get_stylesheet e botsa faele ea style.css ea theme. Haeba ho se na faele e joalo bukeng ea theme, phoso e tla etsahala.

Fumana lintlha tse ngata bakeng sa blog

Qetellong, arolelana mesebetsi e matla haholoanyane e fumanang litsela tsohle tse ka holimo le lintlha tse ling.

<?php get_bloginfo( '$show', '$filter' ) ?>
  • Pitso ea mosebetsi oa PHP: //get_bloginfo e ka fumana lintlha tse fapaneng mabapi le blog,Fumana aterese ea blog ha $show e se e le url
  • Hlahisa: http:// domain name ea hau

Lintlha tse ling tse ka fumanoang ka get_bloginfo:

  • lebitso
  • Tlhaloso
  • wpurl
  • siteurl/url
  • admin_email
  • charset
  • tlhahiso
  • html_mofuta
  • mongolo_tataiso
  • puo
  • stylesheet_url
  • stylesheet_directory
  • template_url
  • template_directory
  • pingback_url
  • atom_url
  • rdf_url
  • rss_url
  • rss2_url
  • maikutlo_atom_url
  • maikutlo_rss2_url

Comments

Aterese ea hau ea lengolo-tsoibila e ke ke ea phatlalatsoa. Ho sebelisoa masimo a hlokahalang * Letšoao

Scroll ho Top