Git Product home page Git Product logo

editor-templates's Introduction

=== Editor Templates ===
Contributors: mboynes, alleyinteractive
Tags: editor, templates, layouts, tinymce
Requires at least: 4.4
Tested up to: 4.8.1
Stable tag: 0.1.0
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Adds the TinyMCE Templates plugin to the visual editor in WordPress.

== Description ==

This plugin adds the [TinyMCE Templates plugin](https://www.tinymce.com/docs/plugins/template/) and adds a WordPress filter (`tinymce_editor_templates`) to make adding templates very simple.

Here's an example:

```
add_filter( 'tinymce_editor_templates', function( $templates ) {
	$templates[] = [
		'title' => 'Jumbotron',
		'description' => 'Bootstrap jumbotron component',
		'content' => '<div class="jumbotron">
			<h1 class="display-3">Hello, world!</h1>
			<p class="lead">This is a simple hero unit, a simple jumbotron-style component for calling extra attention to featured content or information.</p>
			<hr class="my-4">
			<p>It uses utility classes for typography and spacing to space content out within the larger container.</p>
			<p class="lead"><a class="btn btn-primary btn-lg" href="#" role="button">Learn more</a></p>
		</div>',
	];
	return $templates;
} );
```

Most likely, you'll want to make sure you're using [custom editor styles](https://codex.wordpress.org/Editor_Style) so your template markup renders nicely in the editor.

Keep in mind that the editor may strip out some HTML tags and attributes that aren't whitelisted, so you may need to add to that list if any parts of your content get stripped. See [`wp_kses_allowed_html`](https://codex.wordpress.org/Function_Reference/wp_kses_allowed_html) for more information.

== Installation ==

1. Add and activate the plugin through the 'Plugins' menu in WordPress
2. Add your custom templates using the `tinymce_editor_templates` filter (see Description section).

editor-templates's People

Contributors

mboynes avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.