Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/larttyler/metatag

A metadata tagging system for Wordpress
https://github.com/larttyler/metatag

Last synced: 4 days ago
JSON representation

A metadata tagging system for Wordpress

Awesome Lists containing this project

README

        

# Usage

In your page or post, simply add the metatag shortcode:

```
[meta name="title" value="Metatag Demo!"]
[meta name="author" value="Tyler Lartonoix"]

Your post content as usual.
```

In order to gain access to the meta values in your template files (or anywhere else, for that matter) all you need to do is obtain the post content. Metatag hooks into Wordpress's do_shortcode handler to obtain the meta values when the content is parsed. So, an example template file might look like this:

```



= Metatag->get('title', 'Untitled') ?>
Authored by = Metatag->get('author', 'anonymous') ?>




= $content ?>



```

Any values found by Metatag are obtained via the MetaTag#get method, which accepts a key as the first argument, and a default value as an optional second argument. If a default value is not provided, `null` is used.