php 用于WordPress的PHP

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php 用于WordPress的PHP相关的知识,希望对你有一定的参考价值。

/* block / multi-line comment */
// single-line comment
#  single-line comment


/*
common Wordpress theme files:
  page.php    a single page
  single.php  a single blog post
  home.php
  front-page.php for showing a static page or blog posts as a homepage
  wphierarchy.com
  
Wordpress functions:
  get_template_part();  include a PHP file
  
Template Tags:
  the_title();              display the title
  the_content();            display the content
  the_author();
  the_time();               takes PHP date formatting parameters
  bloginfo('name');         the name of the website
  bloginfo('description');  the tagline
  bloginfo('url');
  
WordPress conditional statements:
  ( Check conditional tags page on WordPress Codex )
  is_front_page()
  is_page('about');
  is_single();      if the content is a single blog post
  is_category();
  is_tag();
  is_author();      if the content is by a certain author
  wp_is_mobile();
  is_main_query();  if it's in the main loop
  run any of the above with a !
  
Wordpress Hooks:
  look up filter and actions reference on the codex
  do anything, anywhere, anytime by calling a function
  2 types: "filters" modify or change "anything"
          and "actions" do something "anywhere, anytime"
  add_filter( 'named_function', 'named_function2' );
  add_action( 'action'(trigger), 'named_function');
    actions:
      save_post
      init
      admin_menu
*/

以上是关于php 用于WordPress的PHP的主要内容,如果未能解决你的问题,请参考以下文章

用于 WordPress 的 PHP 片段,用于获取所有产品子类别

PHP 用于wordpress的简单iframe短代码

PHP会话不适用于多个WordPress页面

php 用于WordPress的SAAS REST API

PHP 用于Wordpress网站的Facebook OpenGraph标签

JavaScript + PHP 用于在 Wordpress 中访问 MySQL 数据库