Plugin Directory

Changeset 2820656


Ignore:
Timestamp:
11/18/2022 05:54:52 PM (3 years ago)
Author:
apedestrian
Message:

Version 2.0.0

Location:
seo-lite
Files:
8 added
5 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • seo-lite/trunk/README.txt

    r2769133 r2820656  
    1 === Plugin Name ===
    2 Contributors: apedestrian
    3 Tags: seo, facebook, twitter
    4 Tested up to: 6.0
    5 Stable tag: 1.0.2
     1=== SEO Lite ===
     2Contributors: aPEDESTRIAN
     3Donate link: https://www.paypal.com/donate/?hosted_button_id=JTBPY8ZWAXG6N
     4Stable tag: 2.0.0
     5Tested up to: 6.1.1
     6Tags: seo, open graph, og
    67License: GPLv2 or later
    7 License URI: http://www.gnu.org/licenses/gpl-2.0.html
     8License URI: https://www.gnu.org/licenses/gpl-2.0.html
    89
    9 Adds all of the best practice SEO meta tags to you site.
     10Adds all of the basic Open Graph meta tags to the site head.
    1011
    1112== Description ==
    1213
    13 SEO Lite is meant to be that: lite. Adds all the best practive SEO meta tags and nothing more. It is reccomended that you fill out the Google and Bing verification code in the settings section. Additionally, there is a setting to add your Facebook App ID or Twitter Username for analytics on these platforms.
     14SEO Lite is meant to be that: lite. In under 100 lines of code, SEO Lite adds the following tags:
    1415
    15 == For Developers ==
    16 
    17 Available Filters:
    18 
    19 * seo_lite_meta_title:      SEO Lite will use wp_get_document_title() unless overriden with this filter
    20 * seo_lite_meta_description:    SEO Lite will use the excerpt on pages/posts, archive descriptions on
    21                 archive pages, and the value you set for Site Description inside SEO Lite Settings.
    22 * seo_lite_meta_type:       SEO Lite will use the type article on pages/posts and website everywhere else unless
    23                 overriden with this filter
    24 * seo_lite_meta_attachment_id:  SEO Lite will use a thumbnail on pages/posts and your site icon everywhere else
    25                 unless overriden with this filter
     16* og:locale - Uses get_locale()
     17* og:site_name - Uses get_bloginfo('name')
     18* og:title - Uses wp_get_document_title()
     19* og:description (trimmed to 200 chars) - Uses get_bloginfo('description') on the front page, get_the_excerpt() for posts/pages, and get_the_archive_description() if availble on archive pages
     20* og:url - URL of page
     21* og:type - Uses 'article' on posts/pages and 'website' everywhere else
     22* article:published_time - Uses get_the_date('c') on posts/pages
     23* article:modified_time - Uses get_the_modified_date('c') on posts/pages
     24* og:image - Uses featured image on posts/pages and the site icon on the front page
     25* og:image:{type/width/height/alt} - Added if we have an 'og:image' (only adds 'alt' if availble)
  • seo-lite/trunk/index.php

    r2769133 r2820656  
    1 <?php // Silence is golden
     1<?php defined('ABSPATH') || die;
     2
     3/*
     4    Plugin Name: SEO Lite
     5    Plugin URI: https://github.com/apedestrian/SEO-Lite
     6    Description: Adds all of the basic Open Graph meta tags to the site head.
     7    Version: 2.0.0
     8    Author: aPEDESTRIAN
     9    Author URI: https://github.com/apedestrian
     10    License: GPL-2.0+
     11    License URI: http://www.gnu.org/licenses/gpl-2.0.txt
     12*/
     13
     14// Remove all options. SEO Lite just adds og tags and nothing else from now on; Nothing lite about all those options :(
     15add_action('upgrader_process_complete', function ($upgrader_object, $options) {
     16    if ($options['action'] == 'update' && $options['type'] == 'plugin') {
     17        foreach($options['plugins'] as $each_plugin) {
     18            if ($each_plugin == plugin_basename(__FILE__)) {
     19                delete_option('seo_lite_add_title_tag');
     20                delete_option('seo_lite_site_description');
     21                delete_option('seo_lite_google_code');
     22                delete_option('seo_lite_bing_code');
     23                delete_option('seo_lite_facebook_app_id');
     24                delete_option('seo_lite_twitter_username');
     25            }
     26        }
     27    }
     28}, 10, 2);
     29
     30add_action('wp_head', function () {
     31    ?>
     32        <!------------ <SEO> ------------>
     33        <meta property="og:locale" content="<?php echo esc_attr(get_locale()); ?>">
     34        <meta property="og:site_name" content="<?php echo esc_attr(get_bloginfo('name')); ?>">
     35        <meta property="og:title" content="<?php echo esc_attr(wp_get_document_title()); ?>">
     36        <?php // Front page
     37        if (is_front_page()): ?>
     38            <?php if ($description = get_bloginfo('description')): ?>
     39                <meta property="og:description" content="<?php echo esc_attr((strlen($description) > 200 ? substr($description, 0, 197) . '...' : $description)); ?>">
     40            <?php endif; ?>
     41            <meta property="og:url" content="<?php echo esc_url(home_url()); ?>">
     42            <meta property="og:type" content="website">
     43            <?php if ($attachment_id = get_option('site_icon')): $attachment_meta = wp_get_attachment_metadata($attachment_id); ?>
     44                <meta property="og:image" content="<?php echo esc_url(wp_get_attachment_url($attachment_id)); ?>">
     45                <meta property="og:image:type" content="<?php echo esc_attr(get_post_mime_type($attachment_id)); ?>">
     46                <meta property="og:image:width" content="<?php echo esc_attr($attachment_meta['width']); ?>">
     47                <meta property="og:image:height" content="<?php echo esc_attr($attachment_meta['height']); ?>">
     48                <meta property="og:image:alt" content="<?php echo esc_attr(get_bloginfo('name')); ?>">
     49            <?php endif; ?>
     50        <?php // Single Post and Page
     51        elseif (is_single() || is_page()): ?>
     52            <?php if ($description = get_the_excerpt()): ?>
     53                <meta property="og:description" content="<?php echo esc_attr((strlen($description) > 200 ? substr($description, 0, 197) . '...' : $description)); ?>">
     54            <?php endif; ?>
     55            <meta property="og:url" content="<?php echo esc_url(get_the_permalink()); ?>">
     56            <meta property="og:type" content="article">
     57            <meta property="article:published_time" content="<?php echo esc_attr(get_the_date('c')); ?>">
     58            <meta property="article:modified_time" content="<?php echo esc_attr(get_the_modified_date('c')); ?>">
     59            <?php if ($attachment_id = get_post_thumbnail_id()): $attachment_meta = wp_get_attachment_metadata($attachment_id); ?>
     60                <meta property="og:image" content="<?php echo esc_url(wp_get_attachment_url($attachment_id)); ?>">
     61                <meta property="og:image:type" content="<?php echo esc_attr(get_post_mime_type($attachment_id)); ?>">
     62                <meta property="og:image:width" content="<?php echo esc_attr($attachment_meta['width']); ?>">
     63                <meta property="og:image:height" content="<?php echo esc_attr($attachment_meta['height']); ?>">
     64                <?php if ($attachment_alt == get_post_meta($attachment_id, '_wp_attachment_image_alt', true)): ?>
     65                    <meta property="og:image:alt" content="<?php echo esc_attr($attachment_alt); ?>">
     66                <?php endif; ?>
     67            <?php endif; ?>
     68        <?php // Everything Else
     69        else: global $wp; ?>
     70            <?php if (is_archive()): ?>
     71                <?php if ($description = get_the_archive_description()): ?>
     72                    <meta property="og:description" content="<?php echo esc_attr((strlen($description) > 200 ? substr($description, 0, 197) . '...' : $description)); ?>">
     73                <?php endif; ?>
     74            <?php endif; ?>
     75            <meta property="og:url" content="<?php echo esc_url(get_option('permalink_structure') == '' ? add_query_arg($wp->query_vars, home_url()) : home_url($wp->request)); ?>">
     76            <meta property="og:type" content="website">
     77        <?php endif; ?>
     78        <!------------ </SEO> ----------->
     79    <?php
     80});
  • seo-lite/trunk/uninstall.php

    r2769133 r2820656  
    22
    33// If uninstall not called from WordPress, then exit.
    4 if (!defined('WP_UNINSTALL_PLUGIN'))
    5 {
     4if (!defined('WP_UNINSTALL_PLUGIN')) {
    65    die;
    7 }
    8 else
    9 {
     6} else {
     7    delete_option('seo_lite_add_title_tag');
     8    delete_option('seo_lite_site_description');
    109    delete_option('seo_lite_google_code');
    1110    delete_option('seo_lite_bing_code');
    12     delete_option('seo_lite_site_description');
    13     delete_option('seo_lite_add_title_tag');
    1411    delete_option('seo_lite_facebook_app_id');
    1512    delete_option('seo_lite_twitter_username');
Note: See TracChangeset for help on using the changeset viewer.