0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【WordPress】パンくずリストのプラグイン

0
Posted at

覚書。

WP専用の関数

##よくある
add_filter( 'フックの名前', '実行したい関数名' );

##ページ判定
is_admin()
is_feed()
is_main_query()
is_front_page()
is_home()
is_search()
is_404()
is_archive()
is_singular()
is_page()

##URL関連
home_url('/') トップURLを返す
wp_get_document_title() 今のページのタイトルを取得する。アーカイブページならカテゴリーやタグ名を返す。アーカイブ系はまとめて処理できる。
get_post_type() 投稿の種類を返す
get_option() 指定されたオプションの値を返す
get_permalink() その投稿の記事URLを返す パンくずでは重要
get_the_title() その投稿のタイトル文字列を返す
get_post_type_archive_link() カスタム投稿タイプの一覧ページURLを返す。普通の投稿にはない。
get_post_type_object() 投稿タイプの設計図(≠記事単品)に関する情報の入ったオブジェクトを返す。
get_post() 投稿そのものに関する情報の入ったオブジェクトを返す。

##セキュリティ用エスケープ
esc_url() URLから悪意ある文字を除去。XSS対策。
esc_html() 文字列を安全にし、

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?