Skip to content

Commit

Permalink
Add Site Classification Mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
officiallygod committed Aug 22, 2024
1 parent dd3b672 commit 401d275
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions includes/SiteGen/SiteGen.php
Original file line number Diff line number Diff line change
Expand Up @@ -392,9 +392,23 @@ public static function generate_site_meta( $site_info, $identifier, $skip_cache
self::cache_sitegen_response( $identifier, $parsed_response );

if ( 'siteclassification' === $identifier ) {
// If the user is a writer or a blogger.
if ( 'blog' === $parsed_response['slug'] ) {
self::generate_site_posts( $site_info );
// fetch site classification mapping for generating posts
$site_classification_posts_mapping = self::get_sitegen_from_cache( 'siteclassificationpostsmapping' );
if ( ! $site_classification_posts_mapping ) {
$site_classification_posts_mapping = self::generate_site_meta(
array(
'site_description' => $site_info,
),
'siteclassificationpostsmapping'
);
}

foreach ( $site_classification_posts_mapping['types'] as $site_classification_set ) {
if ( $site_classification_set['primaryType'] === $parsed_response['primaryType']
&& $site_classification_set['secondaryType'] === $parsed_response['slug'] ) {
self::generate_site_posts( $site_info );
break;
}
}
}

Expand Down

0 comments on commit 401d275

Please sign in to comment.