WordPress主题常用模板名称、常用标签和函数大全

首页 WordPress主题常用模板名称、常用标签和函数大全
「WordPress从入门到放弃」QQ交流群:772774006(资源和技术交流)

很多朋友想自学WordPress开发建站,其实自学也并不是很难,首先最基础的就是得会一些基础的html+css+js,最好能看懂一些php基础。

然后就开始了解一些WordPress主题常用的模板名称和WordPress主题常用函数,最后可以尝试动手开发自己的WordPress主题了,在折腾中学习吧 。

下面是WPTOO教程网收集的一些WordPress主题常用模板名称和函数大全,希望能给大家学习WordPress开发建站带来一些帮助。

基本模板文件

文件名描述
style.css主题样式文件
index.php首页模板文件
header.php头部模板文件
single.php单篇文章模板文件
archive.php存档/分类模板文件
searchform.php搜索表单模板文件
search.php搜索模板文件
404.php404 模板文件
comments.php留言模板文件
footer.php底部模板文件
sidebar.php侧边栏模板文件
page.php静态页面模板文件
front-page.php静态首页模板文件
tag.php标签存档模板文件
category.php分类存档模板文件

WordPress主题分类、文章、页面、文章类型等模版都有规定的继承规则和自定义方法,可以查看下面这篇文章,了解下模版继承规则和自定义方法。

点击查看文章

常用主题头部函数

函数名描述
<?php bloginfo('url'); ?>站点根链接
<?php wp_title(); ?>文章或者静态页面标题
<?php bloginfo(‘name’); ?>站点名称
<?php bloginfo(‘description’); ?>站点描述
<?php get_stylesheet_directory(); ?>样式文件所在目录
<?php bloginfo(‘stylesheet_url’); ?>样式文件链接
<?php bloginfo(‘pingback_url’); ?>pingback 链接
<?php bloginfo(‘template_url’); ?>模板文件所在目录链接
<?php bloginfo(‘version’); ?>WordPress 版本
<?php bloginfo(‘atom_url’); ?>atom 链接
<?php bloginfo(‘rss2_url’); ?>rss2 链接
<?php bloginfo(‘url’); ?>网站根链接
<?php bloginfo(‘html_type’); ?>html 版本
<?php bloginfo(‘charset’); ?>字符集

常用主题导航菜单函数

//调用默认导航菜单
<?php wp_nav_menu(); ?>

//调用指定的导航菜单
<?php wp_nav_menu( array(‘menu’ => ‘Project Nav’ )); ?>

//基于分类的导航
<ul id=”menu”>
<li <?php if(is_home()) { ?> <?php } ?>>
<a href=”<?php bloginfo(‘home’); ?>”>Home</a></li>
<?php wp_list_categories(‘title_li=&orderby=id’);?>
</ul>

//基于页面的导航
<ul id=”menu”>
<li <?php if(is_home()) { ?> <?php } ?>>
<a href=”<?php bloginfo(‘home’); ?>”>Home</a></li>
<?php wp_list_pages(‘sort_column=menu_order&depth=1&title_li=’);?>
</ul>

常用模板函数

函数名描述
<?php the_content(); ?>文章内容
<?php if(have_posts()): ?>检查是否有文章
<?php while(have_posts()): the_post(); ?>显示文章
<?php endwhile; ?>结束循环
<?php endif; ?>结束判断
<?php get_header(); ?>头部模板内容
<?php get_sidebar(); ?>侧边栏模板内容
<?php get_footer(); ?>底部模板内容
<?php the_time(‘m-d-y’); ?>显示时间,格式为:’08-18-07′
<?php comments_popup_link(); ?>显示到文章留言的链接
<?php the_title(); ?>文章标题
<?php the_permalink(); ?>文章链接
<?php the_category(); ?>文章分类
<?php the_author(); ?>文章作者
<?php the_ID(); ?>文章 ID
<?php edit_post_link(); ?>文章编辑链接
<?php wp_list_bookmarks(); ?>友情链接列表
<?php comments_template(); ?>留言模板内容
<?php wp_list_pages(); ?>所有页面列表
<?php wp_list_categories(); ?>所有分类列表
<?php next_post_link(‘%link’); ?>下一篇文章链接
<?php previous_post_list(‘%link’); ?>上一篇文章链接
<?php get_calendar(); ?>显示文章日历
<?php wp_get_archives(); ?>存档链接列表
<?php posts_nav_link(); ?>上一篇和下一篇文章链接
<?php rewind_posts(); ?>重回开头开始第二个循环
<?php get_permalink(); ?>获取文章页面固定链接

判断函数

函数名描述
is_home()判断是否为主页
is_single()判断是否为内容页
is_category()判断是否为Category/Archive页
is_tag()判断是否为Tag存档页
is_date()判断是否为指定日期存档页
is_year()判断是否为指定年份存档页
is_month()判断是否为指定月份存档页
is_day()判断是否为指定日存档页
is_time()判断是否为指定时间存档页
is_archive()判断是否为存档页
is_search()判断是否为搜索结果页
is_404()判断是否为404错误页
is_paged()主页/Category/Archive页是否以多页显示
is_user_logged_in()判断用户是否已登录

标题:WordPress主题常用模板名称、常用标签和函数大全

分类:WordPress教程

链接:https://www.wpjc.net/334.html

版权:wpToo教程网(wpToo.com)所分享发布内容,部分为网络转载,如有侵权请立即联系我们,我们第一时间删除并致歉!

评论

Your email address will not be published. Required fields are marked *

  • Brandi
    回复

    Your style is unique compared to other folks I've
    read stuff from. Thank you for posting when you
    have the opportunity, Guess I'll just book mark this page.

    Stop by my blog scr888 zo.star

  • Charline
    回复

    It may be confirmed how the Foo Fighters have already recorded seven tracks.
    Snakes and Arrows was released on May 1st, 2007 and debuted at number three concerning the Billboard 200 document.

    Have a look at mmy web site - https://win8.today

  • Shella
    回复

    Nice weblog right here! Also your site a lot up very fast!
    What web host are you using? Can I am getting your associate hyperlink for your
    host? I wish my site loaded up as quickly as yours lol

    My web site - Live Roulette Vegas

  • Natisha
    回复

    Fantastic Japansex Mom Blog! Do you have any suggestions for aspiring writers?
    I'm hoping to start my own website soon but I'm a little lost on everything.
    Would you recommend starting with a free platform like Wordpress or go for a paid option?
    There are so many options out there that I'm totally overwhelmed ..

    Any tips? Thanks!

    my blog post ... gloryhole wife fuck

  • Chantal
    回复

    That is a really good tip particularly to those
    fresh to the Japansex Mom Blogosphere. Simple but very accurate info… Appreciate
    your sharing this one. A must read article!

    Also visit my webpage :: gloryhole swallows

  • Isabelle
    回复

    That does not mean I'm going to ignore . A visit is the
    person whoo has essentially the most piehes in his/her color.
    8- Use your images with regwrd to found: - Search engine love snapshots.

    my website :: scr888 new version 2018

  • Chris
    回复

    Hey There. I found your blog using msn. This is an extremely well written article.
    I will make sure to bookmark it and come back to read more of your useful information. Thanks for the post.

    I will certainly return.

    Also visit my web page :: scr888 pc

  • JEXAeRvYwN
    回复

    sRqxVAiFpgrfK

  • oxvow
    回复

    just right post, i like it

  • Kennethbek
    回复

    [url=https://erectionclub.us]cialis free trial south africa[/url]
    sildenafil online canada
    [url=https://erectionclub.us]levitra online fast shipping[/url]

  • JoshuaHag
    回复

    [url=https://erection24h.us]otc generic cialis[/url]
    canada cialis otc
    [url=https://erection24h.us]how to get cialis discount[/url]

  • JasonShuro
    回复

    [url=https://erection365.us]buy viagra 50mg uk[/url]
    cheap cialis super active
    [url=https://erection365.us]orr cialis online australia[/url]

  • Bryantjak
    回复

    [url=https://megahard.us]cheapest sildenafil indian[/url]
    viagra cheap online uk
    [url=https://megahard.us]buy generic cialis 20mg[/url]

  • Bryantjak
    回复

    [url=https://superhard.us]viagra buying tablets low cost[/url]
    pill cialis cheap france
    [url=https://superhard.us]sildenafil liquido orale[/url]

  • Bernardsot
    回复

    [url=https://veryhard.us]buy cialis price[/url]
    acheter female viagra online
    [url=https://veryhard.us]teva generic cialis south africa[/url]

  • TimothyIncix
    回复

    [url=https://amoxicillin2021.us]amoxicillin for respiratory infection[/url]
    how much amoxicillin

  • CliftonRah
    回复

    [url=https://celebrex2021.biz]celebrex and psa levels[/url]
    lyrica celebrex

  • AlfredFalay
    回复

    [url=https://erection24h.us]status of over the counter cialis[/url]
    tadalafil 20mg otc

  • Patrickbig
    回复

    [url=https://viaciashop.us]viagra overdose chastity caption[/url]
    india viagra online

  • JasonShuro
    回复

    [url=https://erection365.us]sildenafil 20 mg discount coupon[/url]
    cheap generic cialis
    [url=https://erection365.us]best generic levitra[/url]

  • Alda
    回复

    I have read so many articles about the blogger lovers but this paragraph is actually a fastidious post, keep
    it up.

    My blog :: slot game online terpercaya

  • Bryantjak
    回复

    [url=https://superhard.us]sildenafil 25 mg buy[/url]
    sildenafil 100 mg online
    [url=https://superhard.us]sildenafil tablets 150mg[/url]

  • CarlosCib
    回复

    [url=https://cephalexin2021.us]allergic reaction to cephalexin[/url]
    keflex stomach pain

  • Samueljep
    回复

    [url=https://ciaviageneric.us]where can i buy sildenafil 100mg[/url]
    cialis coupon 20mg

  • CharlesCup
    回复

    [url=https://erection365.us]buy generic cialis australia[/url]
    sildenafil 20 mg price comparison
    [url=https://erection365.us]generic viagra 50mg price[/url]

  • StanleyGow
    回复

    [url=https://erectionclub.us]viagra erection gif[/url]
    otc cialis us

  • WalterSic
    回复

    [url=https://superhard.us]cialis generic acheter[/url]
    generic viagra india australia
    [url=https://superhard.us]compare generic cialis prices[/url]

  • Jameslanty
    回复

    [url=https://viaciashop.us]cialis strength australia[/url]
    online viagra usa

  • JamesFousy
    回复

    cialis samples south africa [url=https://caaliss.us]sildenafil rx coupon[/url] female viagra 2018
    cialis used porn online prices buy cialis amazing tablet ordering viagra low cost

  • Waynehax
    回复

    comprar cialis online amazon [url=https://cialipik.us]where can i get cialis australia[/url] generic cialis wholesale china paypal
    mandy flores viagra 200 mg viagra sildenafil tablets 150mg

  • Petertoomb
    回复

    generic cialis super active 20mg [url=https://ciallispik.us]viagra challenge australia[/url] mature wifes viagra boner
    purchase sildenafil 100 mg cialis combination with over the counter compra online levitra

  • Dwaynecet
    回复

    brand cialis 10mg generic viagra reviews south africa vardenafil vs sildenafil citrate
    viagra prank porn south africa [url=https://ciaviabuy.us]get viagra south africa[/url] how to buy viagra online australia

  • DavidWaX
    回复

    where can i buy real cialis online [url=https://ciaviacheap.us]fake cialis commercial patriots[/url] generic cialis 60 mg
    cialis brand 20mg lilly comprar paypal vardenafil 75 mg cialis cheap fast delivery

  • Danielgaura
    回复

    viagra panama precio [url=https://ciaviageneric.us] wo buy cheap generic viagra[/url] eumed order cialis generico online
    how to get real cialis online sildenafil 50 mg cost cialis 100mg canada

  • CalvinNat
    回复

    sildenafil 25 mg coupon [url=https://ciaviahot.us]cheap cialis 20mg australia[/url] viagra fuck australia
    acheter generic levitra tadalafil 100mg best price cialis daily reddit

  • Charleslar
    回复

    sildenafil 50 mg cost [url=https://ciaviatop.us] buy generic cialis 20mg[/url] comprar viagra 200
    cialis purchase online usa cialis prescription france otc cialis reddit

  • RonaldGep
    回复

    sildenafil 100mg price comparison [url=https://cilaisz.us] cialis commercial bob[/url] cialis video italiano
    generic viagra pictures south africa cialis commercial australia achat viagra 200 mg

  • PhillipFum
    回复

    cheap generic viagra online uk [url=https://erection24h.us] where can i buy sildenafil[/url] cartoon florida redrawn viagra
    viagra generico 60 mg cialis otc italy acheter levitra without prescription

  • ErichMor
    回复

    what is sildenafil citrate [url=https://erectionclub.us]online generic viagra[/url] 100 mg viagra
    viagra penis before and after when to take viagra for best results sophia viagra naked

  • CarlosWew
    回复

    cialis discounts and coupons [url=https://caaliss.us]can you buy cialis over the counter[/url] online cialis without subscription
    cialis cost cialis patent expiration date extended does cialis make you last longer

  • Brucenoume
    回复

    cheap cialis canada pharmacy [url=https://cialipik.us]cialis tadalafil[/url] tadalafil side effects
    where to buy cialis online safely cialis reviews by women cialis vs viagra which is better

  • DavidRok
    回复

    what is the difference between viagra and cialis [url=https://erection24h.us]walmart cialis over the counter[/url] cialis dosage strengths
    online cialis cialis patent expiration date when does cialis patent expire

  • TobiasMog
    回复

    before and after viagra [url=https://erection365.us]teva sildenafil[/url] viagra without a doctor prescription
    generic viagra from india viagra erection buy generic viagra online pharmacy

  • HarrisEcott
    回复

    tadalafil generic india [url=https://cialipik.us]cialis 5mg[/url] walmart cialis over the counter
    canadian online pharmacy cialis tadalafil 5mg cialis couples

  • Richelle
    回复

    It is perfect time to make some plans for the future and it's
    time to be happy. I have read this post and if I could I want to
    suggest you some interesting things or advice. Perhaps you can write next articles referring to this article.
    I desire to read more things about it!

    my blog: php shell download

  • Kimberly
    回复

    Hey there! I simply want to give you a big thumbs up for
    your excellent info you've got right here on this
    post. I am returning to your blog for more soon.

    Also visit my homepage; instagram takipçi satın al

  • Chong
    回复

    These are really wonderful ideas in regarding blogging.
    You have touched some nice points here. Any way keep up wrinting.

    Check out my web-site: Antalya böcek ilaçlama

  • Evangeline
    回复

    I needed to thank you for this fantastic read!! I definitely loved every little bit of it.

    I have got you book marked to check out new
    stuff you post…

    my homepage: Takipçi hilesi

  • JackieJaw
    回复

    sildenafil 20 mg tablet [url=https://ciaviabuy.us]sildenafil 100mg tablets generic[/url] sister viagra
    is there a generic viagra stepmom gives son viagra by mistake viagra hardon pictures

  • MichaelFig
    回复

    viagra without doctor prescription [url=https://ciaviacheap.us]viagra prices[/url] viagra erection after ejaculation
    viagra hard on where to buy viagra over the counter when does viagra patent expire

  • 相关文章