Home » plugins, wordpress, 使い方

記事にPHPプログラムを埋め込む

28 7月 2010 No Comment

Googleマップやカレンダーを記事に埋め込む際HTMLとビジュアルエディターを切り替えるたびにwordpressによってソースが改変されてしまう。これを防ぐためにカスタムフィールドを使う方法を教えていただきました。
長年の悩みが(大げさですが)解消されましたよ。
InsertMetaShortCodeというプラグインを使います。
大感謝です

まず上記からプラグインをダウンロードし通常のステップで有効化しておきます。
で、Googleマップを例にとると、
・Googleマップで目的の場所を表示
・右上の「リンク」をクリック
・「埋め込み地図のカスタマイズとプレビュー」をクリック
・私の場合「カスタム」で幅と高さの数字を入れ直し
・<iframe>で始まるソースをコピー
・wordpressの投稿画面(ページ作成でも同様)で「カスタムフィールド」で「新規追加」
・フィールド名はたとえばmapと入力
・「値」にGoogleマップのソースをペースト
・本文中の地図を張りたい位置に
[insert_meta key=”map”]と入力

完成です。

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.