Last active
March 14, 2022 02:59
-
-
Save freddielore/9d53b956c73cbefb36b85e840628cd0a to your computer and use it in GitHub Desktop.
Revisions
-
freddielore revised this gist
Mar 14, 2022 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -23,16 +23,16 @@ function child_theme_callback_tags( $post ){ return ''; } // to process `categories` and `tags` columns during CSV import, make sure you grab the category and tag id add_action( 'smart_seo_import_update', 'demo_update_categories_tags', 10, 3 ); function demo_update_categories_tags($post_id, $data, $headings){ // check if `categories` column is present on CSV. Value should be integer if( isset( $data['categories'] ) && !empty($data['categories']) ){ wp_set_object_terms($post_id, $data['categories'], 'category'); } // check if `tags` column is present on CSV. Value should be integer if( isset( $data['tags'] ) && !empty($data['tags']) ){ wp_set_object_terms($post_id, $data['tags'], 'post_tag'); } -
freddielore revised this gist
Mar 14, 2022 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -29,12 +29,12 @@ function demo_update_categories_tags($post_id, $data, $headings){ // check if `categories` column is present on CSV if( isset( $data['categories'] ) && !empty($data['categories']) ){ wp_set_object_terms($post_id, $data['categories'], 'category'); } // check if `tags` column is present on CSV if( isset( $data['tags'] ) && !empty($data['tags']) ){ wp_set_object_terms($post_id, $data['tags'], 'post_tag'); } } -
freddielore revised this gist
Mar 14, 2022 . 1 changed file with 17 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -22,4 +22,21 @@ function child_theme_callback_tags( $post ){ } return ''; } // also process `categories` and `tags` columns during CSV import add_action( 'smart_seo_import_update', 'demo_update_categories_tags', 10, 3 ); function demo_update_categories_tags($post_id, $data, $headings){ // check if `categories` column is present on CSV if( isset( $data['categories'] ) && !empty($data['categories']) ){ wp_set_post_terms($post_id, $data['categories'], 'category'); } // check if `tags` column is present on CSV if( isset( $data['tags'] ) && !empty($data['tags']) ){ wp_set_post_terms($post_id, $data['tags'], 'post_tag'); } } ?> -
freddielore created this gist
Jul 8, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,25 @@ <?php // add this to your theme's functions.php or ask your developer to append the following lines add_filter( 'smart_seo_export_fields', 'child_theme_export_tags_categories', 8, 1 ); function child_theme_export_tags_categories( $fields ){ $fields[] = array( 'categories', 'child_theme_callback_categories' ); $fields[] = array( 'tags', 'child_theme_callback_tags' ); return $fields; } function child_theme_callback_categories( $post ){ if( $post->post_type == 'post' ){ return strip_tags( get_the_category_list( ', ', '', $post->ID ) ); } return ''; } function child_theme_callback_tags( $post ){ if( $post->post_type == 'post' ){ return strip_tags( get_the_tag_list( '', ', ', '', $post->ID ) ); } return ''; } ?>