Trusted WordPress tutorials, when you need them most.
Beginner’s Guide to WordPress
WPBカップ
25 Million+
Websites using our plugins
16+
Years of WordPress experience
3000+
WordPress tutorials
by experts

WordPress投稿エディターでコンテンツテンプレートを追加する方法

編集メモ: WPBeginner のパートナーリンクから手数料を得ています。手数料は編集者の意見や評価に影響を与えません。編集プロセスについて詳しく知る。

投稿するコンテンツが同じスタイルになっていませんか?コンテンツテンプレートを作成し、WordPress投稿エディターで再利用できたらいいと思いませんか?この投稿では、WordPress投稿エディターでコンテンツテンプレートを追加する方法を紹介します。

Reusable blocks in a WordPress post

コンテンツテンプレートを使う理由とタイミング

多くのサイトオーナーやブロガーは、ボタン、テーブル、著者プロフィールなどのコンテンツブロックを投稿記事で再利用しています。

テキストエディターでこれらのカスタマイザーHTMLやコンテンツブロックを保存することはできますが、外部アプリを開いてファイルを開き、情報を貼り付ける必要があります。これでは時間がかかりすぎ、執筆の勢いが途切れてしまう。

もう一つの欠点は、他のコンピューターや端末を使用している場合、これらのメモを使用できないことです。

コンテンツテンプレートを作成することで、以下のことが可能になります:

  • 必要な数だけコンテンツテンプレートを作成できる。
  • WordPressにコンテンツテンプレートを保存できます。
  • WordPressの管理エリアからコンテンツテンプレートを管理できます。
  • 投稿エディターから離れることなく、WordPressの投稿でテンプレートを簡単に再利用できます。
  • サイト内の他の投稿者とテンプレートを共有し、投稿記事で再利用できます。
  • WordPressサイトを引っ越した場合でも、コンテンツテンプレートを一緒に移動できます。

それでは、WordPressでそれを実現する方法を見ていきましょう。

WordPressでTinyMCEテンプレートを設定する

まず最初に、TinyMCE Templatesプラグインをインストールして有効化します。プラグインを有効化すると、WordPressの管理メニューに「Templates」という新しいメニュー項目が追加されます。

最初のテンプレートを追加するには、Templates ” Add Newにアクセスする必要があります。

Creating a new template

テンプレートは基本的に、WordPress投稿エディターが完全に機能するカスタム投稿タイプです。ビジュアルエディターを使うこともできますし、テキストエディターに切り替えてより高度なHTMLコードを追加することもできます。また、画像やその他のメディアファイルを追加することもできます。

WordPressの投稿で再利用したいコンテンツブロックを作成することから始めましょう。ショートコードとして挿入」を有効化するオプションが表示されます。このオプションを設定すると、ショートコードを使用してコンテンツブロックを追加できるようになります。

完了したら、公開するボタンをクリックするだけで、コンテンツテンプレートを他のWordPress投稿で使用できるようになります。

WordPress投稿にコンテンツテンプレートを追加する

プラグインを使えば、TinyMCEテンプレートの再利用が非常に簡単になります。新規投稿を作成するか、既存の投稿を編集するだけです。

Insert template button on post editor screen

投稿エディター画面に、Insert Templateという新しいボタンがあります。ボタンをクリックすると、テンプレートの挿入ポップアップが表示されます。

Adding a template into a post

ドロップダウンメニューから、先ほど作成したテンプレートを選択してください。選択したテンプレートのライブプレビューが画面に表示されます。次のテンプレート挿入ボタンをクリックすると、WordPress投稿にテンプレートが追加されます。

Content template inserted into a post

ビジュアルエディターを使用している場合は、投稿に表示されるコンテンツテンプレートが表示されます。テキストエディターを使用している場合は、テンプレートのHTMLが表示されます。これで投稿を保存し、プレビューすることができます。

テンプレートはいくつでも作成でき、投稿の中にいくつでも挿入できます。

この投稿がWordPress投稿エディターでコンテンツテンプレートを追加するのにお役に立てば幸いです。WordPressのビジュアルエディターを使いこなすための14のヒントもご覧ください。

この投稿が気に入ったなら、WordPressの動画チュートリアルをYouTubeチャンネルに登録してください。Twitterや Facebookでも私たちを見つけることができます。

情報開示 私たちのコンテンツは読者支援型です。これは、あなたが私たちのリンクの一部をクリックした場合、私たちはコミッションを得ることができることを意味します。 WPBeginnerの資金源 をご覧ください。3$編集プロセスをご覧ください。

Avatar

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi with over 16 years of experience in WordPress, Web Hosting, eCommerce, SEO, and Marketing. Started in 2009, WPBeginner is now the largest free WordPress resource site in the industry and is often referred to as the Wikipedia for WordPress.

究極のWordPressツールキット

ツールキットへの無料アクセス - すべてのプロフェッショナルが持つべきWordPress関連製品とリソースのコレクション!

Reader Interactions

6件のコメント返信を残す

  1. Syed Balkhi says

    Hey WPBeginner readers,
    Did you know you can win exciting prizes by commenting on WPBeginner?
    Every month, our top blog commenters will win HUGE rewards, including premium WordPress plugin licenses and cash prizes.
    You can get more details about the contest from here.
    Start sharing your thoughts below to stand a chance to win!

  2. Irfan Uygur says

    Very nice and informative article
    I’ve been looking for this feature for months
    One question though: if I use this template say for 10 posts and then later update/change the content will those post’s will be automatically updated ?
    Let’s say I made a table with background color yellow and used it in 10 posts
    If I change my mind later and change the background color to pink will the background color of the 10 posts change to pink as well ?

    • WPBeginner Support says

      When creating your template you can check the option to add template as shortcode. Now when you insert the template into a post, it will simply add the shortcode. You can edit and make changes to your template and those will be reflected on all posts where you have inserted the template as shortcode.

      管理者

    • Mike says

      Why don’t they supply sample data with themes? I’ve been looking for a certain theme, 3 columns, a slider, drop down menu and a few other things. I’ve found a few but when I download and activate them, all I see is Hello World in my newly set up WP.

      I’ve tried importing data but it’s never worked for me. Something always goes wrong, it’s not at all user friendly for novices. I finally found a theme that has Wp files and the sample data. It sets p WP with the sample data for the theme. It’s not rocket science. I just want a head start on setting up my WP with a theme other than Hello World.

      I’m learning Wp from a couple of books and in a few months will be building my own themes for myself, but in the meantime, why can’t I get sample data easily.

返信を残す

コメントありがとうございます。すべてのコメントは私たちのコメントポリシーに従ってモデレートされ、あなたのメールアドレスが公開されることはありませんのでご留意ください。名前欄にキーワードを使用しないでください。個人的で有意義な会話をしましょう。