Code Monkey home page Code Monkey logo

wp-auto-linker's Introduction

WP Auto Linker

Automatically link keywords to users, tags, categories, pages, and more. Associate key characters with URL patterns, and automatically link words in any output.

WP Auto Linker introduces a basic "hashtag" system, making it easy to tag, categorize, and automatically link to things in your content.

Installation

  • Download and install using the built in WordPress plugin installer.
  • Activate in the "Plugins" area of your admin by clicking the "Activate" link.
  • No further setup or configuration is necessary.

FAQ

What is all supported?

  • @ to link to users
  • # to link to post tags
  • $ to link to post categories
  • ^ to link to pages

Examples

Hey everyone! @admin just created the ^about page. #tgif
Hey @bob, can you triage the comments on posts in $kanyewest?

How do I create a custom linker?

Something like:

// Instantiate the linker
$linker = new WP_Auto_Linker();

// Author Archives
$linker->add_linker( array(
	'name'   => esc_html__( 'Single Posts', 'wp-auto-linker' ),
	'char'   => '!',
	'output' => array(
		'filter_single' => array( $linker, 'single_post_link' )
	),
	'input'  => false
) );
  • Name - Not used, but could be used for a UI
  • Char - The control character used on input & output
  • Output - Accepts an array of filter callbacks for single, all, or no matches
  • Input - Accepts an array of filter callbacks for single, all, or no matches

For now, you'll want to create your own callbacks for input & output. As this matures, ideally we'll have a collection of them that can be conveniently hooked into for any post type, taxonomy, etc...

Is this performant?

On input, it's pretty performant. All it does is parse through looking for taxonomy terms to add to posts.

On output, it's maybe less-so, as the_content is filtered and links are applied. The more you link, the more objects need to be pulled up so they can be linked to. If you're caching objects and output, this shouldn't really matter to you. You are caching; right?

Can I extend this for my own objects?

Yes! The main Autolinker class is flexible enough to be used on and for anything, and the wp_auto_linker_setup_default_links() function is a good example of how you might link your custom post-types & taxonomies together.

Does this create new database tables?

No. It uses WordPress's custom post-type, custom taxonomy, and metadata APIs.

Does this modify existing database tables?

No. All of WordPress's core database tables remain untouched.

Where can I get support?

The WordPress support forums: https://wordpress.org/plugins/tags/wp-auto-linker/

Can I contribute?

Yes, please!

wp-auto-linker's People

Contributors

jjj avatar

Watchers

James Cloos avatar  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.