Plugin Directory

Changeset 2392982


Ignore:
Timestamp:
10/03/2020 07:37:06 PM (5 years ago)
Author:
ash_hitch
Message:

Update to version 4.7.0 from GitHub

Location:
add-wpgraphql-seo
Files:
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • add-wpgraphql-seo/tags/4.7.0/CHANGELOG.md

    r2376996 r2392982  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [4.7.0] - 2020-10-03
     9
     10### Added
     11
     12- Primary Category to edge.
    713
    814## [4.6.0] - 2020-09-08
  • add-wpgraphql-seo/tags/4.7.0/README.md

    r2376996 r2392982  
    6060```
    6161{
     62  # Getting Yoast Content Data (posts pages etc)
    6263  pages(first: 10) {
    6364    edges {
     
    128129  }
    129130
    130 
     131# Getting Yoast Category data
    131132  categories(first: 10) {
    132133    edges {
     
    166167  }
    167168
    168 
     169# Getting Yoast User Data
    169170  users {
    170171    nodes {
     
    190191}
    191192
     193# Getting Yoast primary category
     194query GetPostsPrimary {
     195  posts {
     196    nodes {
     197      title
     198      slug
     199      categories {
     200        edges {
     201          isPrimary
     202          node {
     203            name
     204            count
     205          }
     206        }
     207      }
     208    }
     209  }
     210}
    192211
    193212```
  • add-wpgraphql-seo/tags/4.7.0/readme.txt

    r2376996 r2392982  
    55Tested up to: 5.4
    66Requires PHP: 7.1
    7 Stable tag: 4.6.0
     7Stable tag: 4.7.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • add-wpgraphql-seo/tags/4.7.0/wp-graphql-yoast-seo.php

    r2376996 r2392982  
    99 * Text Domain:     wp-graphql-yoast-seo
    1010 * Domain Path:     /languages
    11  * Version:         4.6.0
     11 * Version:         4.7.0
    1212 *
    1313 * @package         WP_Graphql_YOAST_SEO
     
    459459            }
    460460          ]);
     461
     462
     463          // Loop each taxonomy to register on the edge if a category is the primary one.
     464          $taxonomies = get_object_taxonomies($post_type, 'objects');
     465
     466          foreach ($taxonomies as $tax) {
     467
     468
     469            if ($tax->hierarchical && $tax->graphql_single_name) {
     470
     471              $name = ucfirst($post_type_object->graphql_single_name) . 'To' . ucfirst($tax->graphql_single_name) . 'ConnectionEdge';
     472
     473              register_graphql_field($name, 'isPrimary',  [
     474                'type'        => 'Boolean',
     475                'description' => __('The Yoast SEO Primary ' . $tax->name, 'wp-graphql-yoast-seo'),
     476                'resolve'     => function ($item, array $args, AppContext $context) use ($tax) {
     477
     478                  $postId = $item['source']->ID;
     479
     480                  $wpseo_primary_term = new WPSEO_Primary_Term($tax->name, $postId);
     481                  $primaryTaxId = $wpseo_primary_term->get_primary_term();
     482                  $termId = $item['node']->term_id;
     483
     484
     485                  return  $primaryTaxId === $termId;
     486                }
     487              ]);
     488            }
     489          }
     490
    461491        endif;
    462492      }
    463493    }
     494
     495
    464496
    465497    register_graphql_field('User', 'seo',  [
  • add-wpgraphql-seo/trunk/CHANGELOG.md

    r2376996 r2392982  
    55The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
    66and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
     7
     8## [4.7.0] - 2020-10-03
     9
     10### Added
     11
     12- Primary Category to edge.
    713
    814## [4.6.0] - 2020-09-08
  • add-wpgraphql-seo/trunk/README.md

    r2376996 r2392982  
    6060```
    6161{
     62  # Getting Yoast Content Data (posts pages etc)
    6263  pages(first: 10) {
    6364    edges {
     
    128129  }
    129130
    130 
     131# Getting Yoast Category data
    131132  categories(first: 10) {
    132133    edges {
     
    166167  }
    167168
    168 
     169# Getting Yoast User Data
    169170  users {
    170171    nodes {
     
    190191}
    191192
     193# Getting Yoast primary category
     194query GetPostsPrimary {
     195  posts {
     196    nodes {
     197      title
     198      slug
     199      categories {
     200        edges {
     201          isPrimary
     202          node {
     203            name
     204            count
     205          }
     206        }
     207      }
     208    }
     209  }
     210}
    192211
    193212```
  • add-wpgraphql-seo/trunk/readme.txt

    r2376996 r2392982  
    55Tested up to: 5.4
    66Requires PHP: 7.1
    7 Stable tag: 4.6.0
     7Stable tag: 4.7.0
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
  • add-wpgraphql-seo/trunk/wp-graphql-yoast-seo.php

    r2376996 r2392982  
    99 * Text Domain:     wp-graphql-yoast-seo
    1010 * Domain Path:     /languages
    11  * Version:         4.6.0
     11 * Version:         4.7.0
    1212 *
    1313 * @package         WP_Graphql_YOAST_SEO
     
    459459            }
    460460          ]);
     461
     462
     463          // Loop each taxonomy to register on the edge if a category is the primary one.
     464          $taxonomies = get_object_taxonomies($post_type, 'objects');
     465
     466          foreach ($taxonomies as $tax) {
     467
     468
     469            if ($tax->hierarchical && $tax->graphql_single_name) {
     470
     471              $name = ucfirst($post_type_object->graphql_single_name) . 'To' . ucfirst($tax->graphql_single_name) . 'ConnectionEdge';
     472
     473              register_graphql_field($name, 'isPrimary',  [
     474                'type'        => 'Boolean',
     475                'description' => __('The Yoast SEO Primary ' . $tax->name, 'wp-graphql-yoast-seo'),
     476                'resolve'     => function ($item, array $args, AppContext $context) use ($tax) {
     477
     478                  $postId = $item['source']->ID;
     479
     480                  $wpseo_primary_term = new WPSEO_Primary_Term($tax->name, $postId);
     481                  $primaryTaxId = $wpseo_primary_term->get_primary_term();
     482                  $termId = $item['node']->term_id;
     483
     484
     485                  return  $primaryTaxId === $termId;
     486                }
     487              ]);
     488            }
     489          }
     490
    461491        endif;
    462492      }
    463493    }
     494
     495
    464496
    465497    register_graphql_field('User', 'seo',  [
Note: See TracChangeset for help on using the changeset viewer.