Skip to content

Instantly share code, notes, and snippets.

@freddielore
Created August 18, 2019 06:07
Show Gist options
  • Select an option

  • Save freddielore/8d6419a1beac65adfac8c3967bebb045 to your computer and use it in GitHub Desktop.

Select an option

Save freddielore/8d6419a1beac65adfac8c3967bebb045 to your computer and use it in GitHub Desktop.

Revisions

  1. freddielore created this gist Aug 18, 2019.
    23 changes: 23 additions & 0 deletions smart_seo_export_fields.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,23 @@
    <?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' );
    }

    return $fields;
    }

    function callback_language_code( $post ){
    $post_language_details = apply_filters( 'wpml_post_language_details', NULL, $post->ID ) ;
    return $post_language_details['language_code'];
    }

    function callback_parent_lang( $post ){
    return get_the_title( apply_filters( 'wpml_object_id', $post->ID, $post->post_type ) );
    }
    ?>