Skip to content

WordPressUtilities/wpuinternallinks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WPU Internal Links

Handle internal links in content

Build Status

How to

add_filter('wpuinternallinks__links', 'example_wpuinternallinks__links', 10, 1);
function example_wpuinternallinks__links($links) {
    $links[] = array(
        /* Limit to some locales */
        'locales' => array('fr_FR'),
        /* Add an attribute to the converted links */
        'link_attributes' => 'target="_blank"',
        /* Custom classname for converted links */
        'link_classname' => 'my-internal-link',
        /* Target link */
        'url' => 'https://github.com'
        /* 1 : direct string */
        'string' => 'github',
        /* or 2 : list of strings */
        'strings' => array('github','git hub'),
    );
    return $links;
}

Todo

  • Choose exact word ( no letter before or after )
  • Add custom attributes to link.
  • Handle uppercase letters.
  • Choose target language.
  • Custom layout on links ( class )
  • Hook for default attributes.
  • Select post types.
  • Add multiple spellings.
  • Admin page.
  • Only on first link ?
  • Disable on a post (admin).
  • Apply on content/excerpt.
  • Handle accents.

About

Handle internal links in content

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages