Welcome to cuspy.org. Here is my personal site.
Welcome to cuspy.org. Here is my personal site.
wordpressにはRSSを取得して配列に整形する機能が備わってるらしい。…というのを最近TwitterAPI調べてた時知ったのでそれについてのメモ。 バージョンいくつからか詳しく確認してないんだけど、手元にあるので一番古いvar2.1.3には入ってた。 よく考えたらダッシュボードのRSSもコレだよな…ので、新しい情報ではありません。 外部サイトのRSSを取得するには次のように書く include_once(ABSPATH . WPINC . '/rss.php'); $rss = fetch_rss($uri); で、これだけ書いたら詳しい人にはティン!と来るかも。 使用されてるのはMagpieRSS and RSSCacheとSnoopy HTTP client。 たとえば、Twitterのコメントを取得する場合は次のようなソースになる。 include_once(ABSPATH .
WordPressはPHPでできているので、他サイトのRSSを読み込ませてサイドバーなどに新着記事を表示するのも簡単だ…と思っていたら意外と手こずったのでメモ。 いくつかプラグインも配布されているようなのだが、受託案件でデザイン的な制約があったので自作することとする。WordPressではfetch_rss()、wp_rss()、get_rss()という関数が用意されていて、楽に実装できるようだ。それぞれ、fetch_rss()が配列で取得、wp_rss()が<ul>付きでリスト表示、get_rss()が<ul>なしでリスト表示というのが主な違い。 使い方は以下ページで分かりやすく解説されています。 WebTecNote – [WP]wordpressでRSSを取得して表示 詰まったのは日時を表示させようと思ったため。wp_rss()とget_rss()のどちらも記事の投稿日時は表示されな
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く