Plugin Directory

Changeset 2563141


Ignore:
Timestamp:
07/13/2021 01:11:28 AM (5 years ago)
Author:
willfonkam
Message:

Updated to version 1.1

Location:
iaf-headertags/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • iaf-headertags/trunk/iaf-headertags.php

    r2518605 r2563141  
    55 * Author: Fotso Fonkam
    66 * Author URI: http://www.iamfotso.cm
    7  * Version: 1.0
     7 * Version: 1.1
    88 * Licence: GLP2+
    9  * Keywords: description, tag, seo, header, keyworks, optimisation, search, engine
     9 * Keywords: description, tag, seo, header, keyworks, optimisation, search, engine, custom  post types, cpt
    1010 * Text Domain: headertags
    1111 */
  • iaf-headertags/trunk/inc/activate.php

    r2518605 r2563141  
    22function iaf_headertags_activate (){
    33    // Verify WordPress version
    4     if( version_compare( get_bloginfo( 'version' ), '4.4', '<' ) ){
     4    if( version_compare( get_bloginfo( 'version' ), '5.0', '<' ) ){
    55        wp_die( __( 'You must update your WordPress version before you can use this plugin.', 'headertags' ) );
    66    }
  • iaf-headertags/trunk/inc/header.php

    r2518605 r2563141  
    44
    55    // Get options
    6     $iaf_headertags_opts             = get_option( 'iaf-headertags-opts' );
     6    $iaf_headertags_opts                = get_option( 'iaf-headertags-opts' );
    77
    88    // Get article meta-tag
    9     $iaf_headertags_meta_description = get_post_meta( $post->ID, '_iaf_headertags_description', true );
    10     $iaf_headertags_meta_keywords    = get_post_meta( $post->ID, '_iaf_headertags_keywords', true );
     9    $iaf_headertags_meta_description    = get_post_meta( $post->ID, '_iaf_headertags_description', true );
     10    $iaf_headertags_meta_keywords       = get_post_meta( $post->ID, '_iaf_headertags_keywords', true );
     11
     12    // if archives or homepage, exit
     13    if( is_archive() or is_home() ) {
     14        return;
     15    }
    1116
    1217    // If article is a post and manual mode is activated
    1318    if( 'post' == get_post_type() && $iaf_headertags_opts['post_tags'] == 'auto' ) {
    1419        $tags                           = get_the_tags();
     20        $cats                           = get_the_category();
     21
     22        var_dump( $cats );
    1523
    1624        $iaf_headertags_meta_description = get_the_excerpt();
    1725        $iaf_headertags_meta_keywords    = '';
    18         foreach( $tags as $tag ) {
    19             $iaf_headertags_meta_keywords     .= $tag->name . ', ';
     26
     27        // Article has no tags
     28        if( !$tags ) {
     29            foreach( $cats as $cat ) {
     30                $iaf_headertags_meta_keywords   .= $cat->name . ', ';
     31            }
     32        } else {
     33            foreach( $tags as $tag ) {
     34                $iaf_headertags_meta_keywords   .= $tag->name . ', ';
     35            }
    2036        }
    2137
  • iaf-headertags/trunk/readme.txt

    r2518605 r2563141  
    22Contributors: willfonkam
    33Tags: description, tag, seo, header, keyworks, optimisation, search, engine
    4 Requires at least: 4.9
    5 Tested up to: 5.7.1
    6 Stable tag: 1.0
     4Requires at least: 5.0
     5Tested up to: 5.7.2
     6Stable tag: 1.1
    77License: GPL2+
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2727= 1.0 =
    2828* Initial release.
     29
     30= 1.1 =
     31* Added feature: if post has no tag, categoreies will be used as default keywords
Note: See TracChangeset for help on using the changeset viewer.