This file contains 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 characters
<?php | |
/** Originally from https://labs.freddielore.com/how-to-export-yoast-woocommerce-gtin-data-to-csv-for-bulk-import/ | |
*/ | |
// add `gtin8`, `gtin12`, `gtin13`, `gtin14`, `isbn`, `mpn` columns in CSV export | |
add_filter( 'smart_seo_export_fields', 'demo_export_yoast_gtin_data', 8, 1 ); | |
function demo_export_yoast_gtin_data( $fields ){ | |
$fields[] = array( 'gtin8', 'demo_get_gtin8' ); | |
$fields[] = array( 'gtin12', 'demo_get_gtin12' ); |
This file contains 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 characters
<?php | |
add_action( 'smart_seo_import_update', '_child_theme_create_post_with_custom_fields', 10, 3 ); | |
function _child_theme_create_post_with_custom_fields($post_id, $data, $columns){ | |
if( $post_id == 0 || $post_id == '0' ){ | |
$args = array( 'post_title' => $data['post_title'], | |
'post_status' => 'publish', | |
'post_type' => $data['post_type'] ); |
This file contains 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 characters
<?php | |
// add feactured_image column in CSV | |
add_filter( 'smart_seo_export_fields', 'fsl_export_other_custom_fields', 8, 1 ); | |
function fsl_export_other_custom_fields( $fields ){ | |
$fields[] = array( 'featured_image', 'fsl_get_featuredimage' ); | |
return $fields; | |
} | |
function fsl_get_featuredimage( $post ){ | |
if( has_post_thumbnail( $post->ID ) ){ |
This file contains 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 characters
<?php | |
add_filter( 'smart_seo_export_fields', 'theme_export_tax_custom_fields', 8, 1 ); | |
function theme_export_tax_custom_fields( $fields ){ | |
$fields[] = 'custom_field_name_1'; | |
$fields[] = 'custom_field_name_2'; | |
return $fields; | |
} | |
add_action( 'smart_seo_import_update', 'theme_update_more_tax_custom_fields', 10, 2 ); | |
function theme_update_more_tax_custom_fields($term_id, $data){ |
This file contains 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 characters
/* Accordion | |
------------------------------------------------------------ */ | |
.schema-faq-question{ | |
cursor: pointer; | |
} | |
.schema-faq-question:before{ | |
width: 16px; | |
height: 20px; | |
display: inline-block; |
This file contains 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 characters
<?php | |
add_filter( 'smart_seo_export_desc', 'demo_export_default_seo_desc', 8, 2 ); | |
function demo_export_default_seo_desc( $desc, $post ){ | |
// ensuring no shortcodes are being retrieved | |
return strip_shortcodes( $desc ); | |
} | |
?> |
This file contains 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 characters
<?php | |
// add this to your theme's functions.php or ask your developer to append the following lines | |
add_filter( 'smart_seo_export_fields', 'demo_export_other_custom_fields', 8, 1 ); | |
function demo_export_other_custom_fields( $fields ){ | |
// See if this is a WPML site and add columns "language_code", "parent_title" to CSV | |
if( class_exists( 'SitePress' ) ){ | |
$fields[] = array( 'language_code', 'callback_language_code' ); | |
$fields[] = array( 'parent_title', 'callback_parent_lang' ); | |
} |
This file contains 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 characters
<?php | |
add_filter( 'smart_seo_export_title', 'demo_export_default_seo_titles_v2', 8, 2 ); | |
function demo_export_default_seo_titles_v2( $title, $post ){ | |
// if no custom SEO title being defined, get global defaults for Yoast | |
if( class_exists('WPSEO_Option' ) && empty($title) ){ | |
$settings = get_option( 'wpseo_titles' ); | |
$replacer = new WPSEO_Replace_Vars(); | |
$title = $replacer->replace( $settings['title-' . $post->post_type], $post ); | |
} |
This file contains 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 characters
add_filter( 'smart_seo_export_title', 'demo_export_default_seo_titles', 8, 2 ); | |
function demo_export_default_seo_titles( $title, $post ){ | |
// if no custom SEO title being defined, get global defaults for Yoast | |
if( class_exists('WPSEO_Option' ) && empty($title) ){ | |
$settings = get_option( 'wpseo_titles' ); | |
$title = $settings['title-' . $post->post_type]; | |
} |
NewerOlder