Skip to main content

Home/ WordPress Beginners/ Group items tagged codex

Rss Feed Group items tagged

9More

[WP]テンプレートファイルの仕様と構成 - WebTecNote - 0 views

  • Wordpressのデザインはテーマと呼ばれてます。テーマを構成するファイル群がテンプレートファイルです。 他のブログのようにテーマをテンプレートと呼んでも通じるけど、検索するときはテーマ(Theme)を使う方が良いかも。 ダウンロードしたばかりだと"Classic" と "Default"の2つがプリインストールされてますが、 テーマ新しく追加する場合は、ダウンロードして解凍したテーマのフォルダをWordpressのwp-content/themes/にアップロードするだけ。 デザイン(表示)に並ぶテーマのスクリーンショットをクリックすれば即座に変更されます。 テーマ変更で再構築が必要ない、というのがWordpressの良いところ。 Wordpressは1.x系、2.0.x系、2.1.x系、2.2以降と2.5では内部仕様が違ってるので、テーマやプラグインはバージョンにあったものを選ばないとエラーが出たりするので注意。 特に2.5は最新とあって対応してるテーマやプラグインもまだ少ないようです。 公式のリスト» WordPress 2.5 Theme Compatibility List WordPress 2.5 Plugin Compatibility List
  • Wordpressはコアファイル・プラグイン等全てPHPなので、PHPとmySQLに通じていればかなり色々なことができます。 テーマを構成するテンプレートファイルは、XHTMLとPHPのテンプレートタグで作成されてます。 XHTMLとUTF-8で記述するのがベターですが、HTMLでも文字コードさえ合ってれば問題はないです。 文字コードはWordpress2.5ではUTF-8のみになりました。 テキストエディタはBOM無しのUTF-8で保存できるものを選ぶ必要があります。(メモ帳はダメ!絶対)
  • テンプレートに記述するWordpress独自のPHPコードはテンプレートタグの他、ループやファンクションなどかなり色々使えます。 PHPの関数や変数なんかも使えま
  • ...6 more annotations...
  • テンプレートファイル群の中に特別重要なものが2つあります。style.cssとfunctions.phpです。 style.cssにはただのphpファイルの集まりに過ぎないフォルダを、Wordpressにテーマと認識させる重要なコメントが入ります。 functions.phpはテーマで使う関数や初期設定、ウィジェットなどのソースコードが入ります。(無くても動きます) style.cssを開くと、冒頭にコメントが入ってます。 このコメントがないとテーマと認識されません。
  • 基本テンプレート一覧 style.css(必須) テーマのメインとなるスタイルシートファイル。上で書いたコメントが必要。@importで他のCSSを読み込む事が出来ます index.php メインテンプレート。カテゴリやページ、シングルページにそれぞれテンプレートファイルがある場合はそちらが優先して使用されます。最低これとcomments.phpがあれば動く。 comments.php コメントエリア表示用テンプレート。コメントフォームとコメントのリスト表示を担当します。Defaultのテンプレートを流用するのがベター。 comments-popup.php ポップアップのコメントエリア表示用テンプレート。Defaultのテンプレートを流用するのがベター。 headにcomments_popup_script();、ループ内にcomments_popup_link();があると表示される。 テーマ内にテンプレートが見つからない場合は、Deafaultのテンプレートが使用される。 home.php ホームページ用のテンプレート。固定ページに設定しない場合にこのテンプレートファイルがあると、トップだけこのテンプレートが使われます。 single.php 投稿記事用テンプレート。時事系列に沿わないページには適用されない。 page.php ページ用テンプレート。ページは1ページずつ独自のテンプレートを設定することも出来ますが、それが設定されてない場合に使用される。 paged.php archive.phpやsearch.phpで2ページ目以降がある場合に使われる。category.php・date.php・author.phpがある場合はそちらが優先されるので使用されない。 category.php カテゴリー用テンプレート。カテゴリー一覧を表示する際に使用される。 author.php 投稿者用テンプレート。投稿者情報を表示する際に使用される。 date.php 日時クエリで表示する際に使用されるテンプレート。アーカイブと似てる archive.php アーカイブ表示用テンプレート。表示優先順位はcategory.php、author.php、date.phpより下。 search.php 検索結果用テンプレート。無い場合はindex.phpが使われる。 404.php 404 Not Found用のテンプレート。無い場合はindex.php。 image.php 画像表示用テンプレート。[gallary]の画像ファイル単体表示(v2.5~) attachment.php 画像表示用テンプレート。「ページにリンク」を選択した時の画像表示用 tag.php タグ用テンプレート。タグのアーカイブ表示
  • パーツテンプレート 呼び出しタグが用意されているパーツテンプレートは次の通り。 header.php(get_header();) ヘッダ出力用のテンプレート。 footer.php(get_footer();) フッター出力用のテンプレート。 sidebar.php(get_sidebar();) サイドバー出力用のテンプレート 関数がなくてもincludeなどで取得して表示することが出来ます。
  • Page Templates ページには、各ページごとにそれぞれ独自のテンプレートを使うことが出来ます。 作成方法は、任意の名前.phpでファイルを作成して、冒頭に次のコメントを入れるだけ。
  • Category Templates カテゴリーを表示するテンプレートはいくつかあります。優先順位は次の通り。 category-6.php category.php archive.php index.php category-6.phpのように英数をつけたテンプレートを作ると、英数と同じIDのカテゴリーを表示するときだけ使用されます。
  • Author Templates 投稿者ページを表示するには、まず次のリンクをループ内に記述します。
1More

Migrating Plugins and Themes « WordPress Codex - 0 views

  • This article is a list of other Codex articles that cover how to upgrade your plugins and themes from one WordPress version to the next. Upgrade 1.2 to 1.5 - Covers how to convert a really old Theme to the current theming system. Migrating Plugins and Themes to 2.1 - Covers changes between WordPress 2.0 and WordPress 2.1 Migrating Plugins and Themes to 2.2 - Covers changes between WordPress 2.1 and WordPress 2.2 Migrating Plugins and Themes to 2.3 - Covers changes between WordPress 2.2 and WordPress 2.3 Migrating Plugins and Themes to 2.5 - Covers changes between WordPress 2.3 and WordPress 2.5 (there was no version 2.4) You may also want to check: Plugin Compatibility List Theme Compatibility List
1More

DBS>Interactive | WordPress Function List - 0 views

  • The content was reformatted for quick reference from the Template Tag section of the WordPress.org Codex, a relative encyclopedia to WordPress theming, and great reference for your WordPress questions.
2More

[WP]管理ページに任意のメニューとページを追加する - WebTecNote - 0 views

  • デフォルトテーマはヘッダのグラデーションがテーマ内のタブから変更出来るようになってます。 管理ページのメニューやページの追加も、テーマのfunction.phpから可能です。
  • add_menu_page(ページタイトル, メニューのタイトル,表示するユーザレベルまたは能力, ファイル名, 実行する関数名); add_theme_pageも同じ。 他には、add_options_page、add_management_page、add_submenu_pageなどがある。 表示するユーザレベルまたは能力については、ユーザレベル(0~10)か管理能力名(edit_themes等)で指定。 Docs:Adding Administration Menus basename(__FILE__)だとfunctions.phpがページのURLになるので、2つ3つ追加する場合は名前を指定する。 インクルードも使える。
1More

WordPressウィジェット一覧 - 0 views

  •  
    WordPress CodexのThird Party Widgetsより、 2007.5.18現在、177個 * 30Boxes (http://ottodestruct.com/blog/2006/04/28/30boxes-widget/) - 30Boxes カレンダーのエベントを表示(要PHP 5) * A Yahoo SiteExplorer Widget (http://www.utheguru.com/yahoo-sidebar-link-badge-widget-for-wordpress/) - Yahoo Site Explorer Badge をウィジェット化 - デモ:Yahoo Badge Widget Demo * About Me Widget (http://www.samdevol.com/about-me-widget-for-wordpress/) - 画像などを加えた'About Me'(自分について)を表示 * Active Discussions (http://jayandrewallen.com/active-discussions-sidebar-plug-in-for-wordpress-20/) - コメントの多い投稿を表示 * Ad Rotator (http://kpumuk.info/wordpress/wordpress-widgets-ad-rotator/) - <!-more->で区切った複数のHTMLコードを順番に表示 * AddThis Sidebar Wiget (http://foolip.org/blog/2007/05/06/addthis-sidebar-widget/) - フィード購読とソーシャルブックマークのボタン * Adsense Widget for WordPress (http://www.mikesmullin.com/2006/04/01/adsense-widget-wordpress-sidebar/) - Adsenseの色、サイズ、h2をコントロール * Apple Trailer (http://www.sosuechtig.de/wordpress-widgets/) - apple.com から映画の予告編をランダムに表示 * Around This Date In The Past (http://www.junyent.org/blog/arxius/2006/05/20/around-this-date-in-the-past-wordpress-widget/) - x 年前の今日の投稿記事を表示 * Associative Dictionary (http://dirkie.nu/2006/05/01/associative-dictionary-widget/) - 個人辞書を作成表示 * AvFuel (http://blog.dannyevarts.net/2006/06/28/avfuel-my-first-useful-wordpress-widget/) - 最新の航空燃料の値段を表示 * Battlefield 2 Stats (http://www.viper007bond.com/wordpress-plugins/battlefield-2-stats/) - Battlefield 2 プロファイルを表示 * BDP RSS Agregator (http://wordpress.org/support/topic/67364?replies=1) - BDP RSS Agregator plugin (http://www.ozpolitics.inf
5More

Plugins/WordPress Widgets « WordPress Codex - 0 views

  • Pre Wordpress 2.3 Widgets WordPress Widgets (WPW) is like a plugin, but designed to provide a simple way to arrange the various elements of your sidebar content (known as "widgets") without having to change any code. The Widgets SubPanel explains how to use the various Widgets that come delivered with WordPress, and the Widgets page at Automattic explains how to 'widgetize' themes and plugins. Using Text Widgets Using RSS Widgets Widget-ready themes Resources
  • Last.fm - last.fm music charts as a graphic in your sidebar Last.fm Adds the new version of the chart. Customizable color and type.
  • Feedburner - subscribe to blog via Feedburner Flickr Badge Widget - display your flickr photos in the sidebar Flickr Widget - same widget that www.wordpress.com uses flickr RSS Widgets - display flickr Photos on sidebar Flickr Photo Album - display Flickr album sets FlickerRSS - display Flickr photos; requires flickrRSS Plugin Flickr Spinnr - display Flickr photos in rotating cube Flickr Tag Cloud Widget - display a link tag cloud from your Flickr account
  • ...2 more annotations...
  • In many cases, the built-in Text Widget can be used to add new abilities to your sidebar. The Widget Plugin allows you to specify how many text widgets you need. Once you have specified the number of text widgets you need, each of those widgets is added to the "Available Widgets" column in the Presentation, Sidebar Widget Administration Panel. Clicking on the icon on the right side of the widget allows you to enter the widget Options. There you can enter a description or title for that particular widget and also enter (in the large text box) the text or HTML code for the widget. Here's a list of content known to work via text widgets. Each of these content providers supplies the necessary code for you to copy and paste into your widget to display their content on your blog.
  • The built-in RSS Widget can be used to add feeds to your sidebar. The Widget Plugin allows you to specify how many RSS widgets you need. Once you have specified the number of RSS widgets you need, each of those widgets is added to the "Available Widgets" column in the Presentation, Sidebar Widget Administration Panel. Clicking on the icon on the right side of the widget allows you to enter the URL for the feed, a description of the feed, and how many items from the feed you want displayed. Here's a sample of RSS feeds you can use in your widgets.
2More

[WP]Wordpress オプションページの作成 - WebTecNote - 0 views

  • どうしても作りたいプラグインが出来たので試しに作ってみてるが、その際避けて通れないオプション設定ページ。 テーマの独自設定を作りたい時にも使える。 Creating Options Pagesから適当に抜粋。 ページそのものの追加は前のエントリーで紹介してるので省略。 最後の方に設定保存のメカニズムについても適当に解説をつけてみた。
  • WordpressはデータベースのOptionsテーブルを使って設定を保存します。 オプションとして保存出来る値は、文字・配列・PHPオブジェクトである。 他のプラグインと衝突しないために、オプション名は独自性のある文字列でなければならない。 phpmyadminか何かで、Optionsテーブルのoption_nameやoption_valueを見るとプラグインの設定が保存されてるのが確認出来ます。 メイン関数。この関数を使うとOptionsにアクセスできる。
1 - 7 of 7
Showing 20 items per page