New Unofficial Plugin: Auto Description :)

0

Hello everyone!

Another week, another plugin!

Wait, I just released another plugin this week… Oh well :slight_smile:

Backstory time!

I was making a website for a customer and he was like: I need SEO!

Well, the theme I used didn’t have any advanced SEO settings, and I’m not really into using bloated plugins.

So I made my own! Extracted and rewritten from my main website’s theme to always have SEO at hand!

This “plugin” was originally made within a Genesis Theme (named LightSpring (it’s my own theme!)) so it fully support Genesis themes!

But making this plugin, I noticed it doesn’t really like non-genesis themes. So I fixed that :slight_smile:

Anyway, backstory time has ended :slight_frown:

What this plugin does is adding a few nice things to the header with Facebook in mind:

  1. Meta description, ~160 chars stripped from content (could be shorter because it contains full words only)
  2. og:description, same as above
  3. og:image, pulled from your header image if set
  4. og:locale, pulled from the site language settings if set, defaults to en_US otherwise
  5. og:type, website, duh :smiley:
  6. og:title, Page Title – My Site Name
  7. og:url, full path to current page
  8. og:site_name, the blog name :slight_smile:

On the home page, the og:title is instead of “Page Title – My Site Name” the following: “My Site Name – Blog Tagline”. Now isn’t that nice? :slight_smile:

Translating:

Its default language is English, the one non-dynamic word: “on” can be translated.

It’s already translated to Dutch :slight_smile:

Got a translation suggestion? Please submit ^^

Post Title “on” Blog Name

One small word of caution though:

This is a heavy plugin on extreme content-rich pages (100x as much text as this whole post).

It adds 0.5 seconds of load time if you have a whopping 241,000 characters on that page (tested on a hexacore with prefork)! This post contains about 2,000 characters.

So if you publish books as pages, lol, and are not using caching plugin, I suggest hesitating about using this plugin or using a Genesis theme and filling in the SEO description on heavy pages manually, because then this plugin won’t automatically generate a description while stripping HTML and Shortcodes.

The download:

https://hostmijnpagina.nl/share/autodescription.zip

Install it as a plugin and activate it :slight_smile:

No edits or configuration required! As the plugin says: Auto Description :smiley:

Enjoy! :slight_smile:

Feedback, suggestions or questions can be asked within this topic =)

P.S.

This plugin uses mb_strlen(), I think it fallbacks to strlen if “Mbstring” isn’t present in the server. But if it doesn’t, please ask your Hosting Provider to install mbstring :slight_smile:

It’s a better way of calculating the characters in foreign languages with special characters.

  • Sybre Waaijer
    • The Incredible Code Injector

    Updated 1.0.1:

    No more PHP warning from the defined thingy, now uses wp_get_theme() to get the root name of the theme name (for Genesis check).

    If you don’t use Genesis you won’t be seeing an error any more :slight_smile:

    Tested out this plugin as well (was about time, right? :smiley:), works brilliantly ^^, Enjoy!

    New plugin coming soon! It will be a lighter version of this one containing Blatavars and an upload page for iOS/Windows8/Facebook images :smiley:

  • Sybre Waaijer
    • The Incredible Code Injector

    Upgraded this plugin to a mu-plugin with a filter!

    The download: https://hostmijnpagina.nl/share/autodescription-mu.zip

    The use:

    1. Upload the contents of mu-plugins in /wp-content/mu-plugins/

    2. Don’t have the folder yet? You can create it now! :slight_smile:

    3. The plugin is activated for all the sites in your network now by default!

    The filter:

    Got a theme or site where you’ve covered all the meta data already? Simply add this to functions.php or a plugin and activate it and it will not output the contents of the mu-plugin on your site:

    //* Disable autodescription, fill in anything but the number 1 or TRUE :)
    add_filter('autodescription_mu_load', 'anything_but_1' );

    Enjoy :slight_smile:

    EDIT: fixed :3

  • Sybre Waaijer
    • The Incredible Code Injector

    Hello :slight_smile:

    I’m thinking about adding a ld+json script. This will tell Google how to search your website (the WordPress way).

    It’s explained here:

    https://developers.example.com/structured-data/slsb-overview

    I am however unsure if it will have any positive effect on search page ranking. I’m also unsure if people would wish to use this :slight_smile:

    People reported to have a bigger engagement with the visitors this way, I lost the link explaining this lol.

    You could for example also use microdata on your search form. But that would require some advanced manipulation in your search boxes if you haven’t programmed them yourself, the microdata also only has to be put on the homepage. So this makes things more difficult.

    Either way, the code is done, I just want to know what you guys think about it before I add it to this plugin ^^

    Google Structured data recognizes it as valid :slight_smile:

    Of course, I haven’t looked all the way into it so therefor I’m unsure if people want this =)

    The code which will be placed into the footer:

    //* Place the Google Analytics+ code in the footer
    add_action('get_footer', 'hmpl_filter_footer_theme');
    function hmpl_filter_footer_theme(){
    global $google_analytics_async;
    add_action( 'wp_footer', array( $google_analytics_async, 'tracking_code_output'));

    if ( !is_user_logged_in() && !is_search() && !is_404() ) {
    add_action( 'wp_footer', 'hmpl_ld_json' );
    }
    }

    //* Google LD+JSON search helper
    function hmpl_ld_json($output) {
    $context = json_encode( 'http://schema.org' );
    $webtype = json_encode( 'Website' );
    $url = json_encode( esc_url( home_url( '/' ) ) );
    $name = json_encode( get_bloginfo('name') );
    $actiontype = json_encode( 'SearchAction' );
    $target = json_encode( esc_url( home_url( '/' )) . '?s={search_term}' );
    $queryaction = json_encode( 'required name=search_term' );

    $pre_output = sprintf( '{"@context":%s,"@type":%s,"url":%s,"name":%s,"potentialAction":{"@type":%s,"target":%s,"query-input":%s}}', $context, $webtype, $url, $name, $actiontype, $target, $queryaction );

    $output = '<script type='application/ld+json'>' . $pre_output . '</script>';

    echo $output;
    }

    It will look like this:

    <script type='application/ld+json'>{"@context":"http://schema.org","@type":"Website","url":"https://hostmijnpagina.nl/","name":"Host Mijn Pagina":{"@type":"SearchAction","target":"https://hostmijnpagina.nl/?s={search_term}","query-input":"required name=search_term"}}</script>

  • Sybre Waaijer
    • The Incredible Code Injector

    Updated to 2.0.0!

    Not only does it have exactly 1337 lines of code, but it also features WPMUdev’s domain mapping support for the canonical URL :smiley:, the Domain Mapping plugin is featured in the plugin page :slight_smile:

    It also features manual SEO options :slight_smile: Much cleaner than the more popular SEO plugins and is perfectly suitable for multisite ^^ Enjoy :slight_smile:

    1337 lines of proof: https://plugins.trac.wordpress.org/changeset/1179256/ :smiley: