function epl_wpimport_register_fields()
{
    global $epl_ai_meta_fields, $epl_wpimport;
    // Initialize EPL WP All Import Pro add-on.
    $epl_wpimport = new RapidAddon('Easy Property Listings Custom Fields', 'epl_wpimport_addon');
    if (!empty($epl_ai_meta_fields)) {
        foreach ($epl_ai_meta_fields as $epl_meta_box) {
            if (!empty($epl_meta_box['groups'])) {
                foreach ($epl_meta_box['groups'] as $group) {
                    $epl_wpimport->add_title($group['label'], $group['label']);
                    $fields = $group['fields'];
                    $fields = array_filter($fields);
                    if (!empty($fields)) {
                        foreach ($fields as $field) {
                            switch ($field['type']) {
                                case 'textarea':
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'textarea');
                                    break;
                                case 'url':
                                case 'date':
                                case 'sold-date':
                                case 'sold-date':
                                case 'auction-date':
                                case 'decimal':
                                case 'number':
                                case 'checkbox':
                                case 'checkbox_single':
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'text');
                                    break;
                                case 'select':
                                case 'radio':
                                    $opts = isset($field['opts']) ? $field['opts'] : array();
                                    if (!empty($opts)) {
                                        foreach ($opts as $opt_key => &$opt_value) {
                                            if (is_array($opt_value)) {
                                                $opts[$opt_key] = $opt_value['label'];
                                            }
                                        }
                                    }
                                    $epl_wpimport->add_field($field['name'], $field['label'], 'radio', array());
                                    break;
                                default:
                                    $type = in_array($field['type'], array('text', 'hidden')) ? 'text' : $field['type'];
                                    $epl_wpimport->add_field($field['name'], $field['label'], $type);
                                    break;
                            }
                        }
                    }
                }
            }
        }
        // Register Import Function
        $epl_wpimport->set_import_function('epl_wpimport_import_function');
        // display a dismiss able notice warning the user to install WP All Import to use the add-on.
        $epl_wpimport->admin_notice("Easy Property Listings Importer plugin recommends you install <a href='http://www.wpallimport.com/'>WP All Import Pro 4.2.6+</a>");
        // the add-on will run for all themes/post types if no arguments are passed to run()
        $epl_wpimport->run(array("post_types" => epl_get_core_post_types()));
    }
}
<?php

/*
Plugin Name: Yoast SEO Add-On
Description: A complete example add-on for importing data to certain Yoast SEO fields.
Version: 1.0
Author: WP All Import
*/
include "rapid-addon.php";
$yoast_seo_addon = new RapidAddon('Yoast SEO Add-On', 'yoast_seo_addon');
$yoast_seo_addon->add_field('yoast_wpseo_title', 'SEO Title', 'text');
$yoast_seo_addon->add_field('yoast_wpseo_metadesc', 'Meta Description', 'text');
$yoast_seo_addon->add_field('yoast_wpseo_meta-robots-noindex', 'Meta Robots Index', 'radio', array('' => 'default', '1' => 'noindex', '2' => 'index'));
$yoast_seo_addon->add_field('yoast_wpseo_opengraph-image', 'Facebook Image', 'image');
$yoast_seo_addon->set_import_function('yoast_seo_addon_import');
// display a dismissable notice warning the user to install WP All Import to use the add-on.
// Customize the notice text by passing a string to admin_notice(), i.e. admin_notice("XYZ Theme recommends you install WP All Import (free | pro)")
$yoast_seo_addon->admin_notice();
// the add-on will run for all themes/post types if no arguments are passed to run()
$yoast_seo_addon->run();
function yoast_seo_addon_import($post_id, $data, $import_options)
{
    global $yoast_seo_addon;
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_title', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_title', $data['yoast_wpseo_title']);
    }
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_metadesc', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_metadesc', $data['yoast_wpseo_metadesc']);
    }
    if ($yoast_seo_addon->can_update_meta('_yoast_wpseo_meta-robots-noindex', $import_options)) {
        update_post_meta($post_id, '_yoast_wpseo_meta-robots-noindex', $data['yoast_wpseo_meta-robots-noindex']);
Пример #3
0
<?php

/*
Plugin Name: WP All Import - Yoast WordPress SEO Add-On
Plugin URI: http://www.wpallimport.com/
Description: Import data into Yoast WordPress SEO with WP All Import.
Version: 1.1.0
Author: Soflyy
*/
include "rapid-addon.php";
include_once ABSPATH . 'wp-admin/includes/plugin.php';
$yoast_addon = new RapidAddon('Yoast WordPress SEO Add-On', 'yoast_addon');
$yoast_addon->add_field('_yoast_wpseo_focuskw', 'Focus Keyword', 'text', null, 'Pick the main keyword or keyphrase that this post/page is about.');
$yoast_addon->add_field('_yoast_wpseo_title', 'SEO Title', 'text', null, 'The SEO title defaults to what is generated based on this sites title template for this posttype.');
$yoast_addon->add_field('_yoast_wpseo_metadesc', 'Meta Description', 'text', null, 'The meta description will be limited to 156 chars. It is often shown as the black text under the title in a search result. For this to work it has to contain the keyword that was searched for.');
$yoast_addon->add_options($yoast_addon->add_field('_yoast_wpseo_opengraph-title', 'Facebook Title', 'text', null, "If you don't want to use the post title for sharing the post on Facebook but instead want another title there, import it here."), 'Facebook Options', array($yoast_addon->add_field('_yoast_wpseo_opengraph-description', 'Description', 'text', null, "If you don't want to use the meta description for sharing the post on Facebook but want another description there, write it here."), $yoast_addon->add_field('_yoast_wpseo_opengraph-image', 'Image', 'image', null, "If you want to override the image used on Facebook for this post, import one here. The recommended image size for Facebook is 1200 x 628px.")));
$yoast_addon->add_options($yoast_addon->add_field('_yoast_wpseo_twitter-title', 'Twitter Title', 'text', null, "If you don't want to use the post title for sharing the post on Twitter but instead want another title there, import it here."), 'Twitter Options', array($yoast_addon->add_field('_yoast_wpseo_twitter-description', 'Description', 'text', null, "If you don't want to use the meta description for sharing the post on Twitter but want another description there, import it here."), $yoast_addon->add_field('_yoast_wpseo_twitter-image', 'Image', 'image', null, "If you want to override the image used on Twitter for this post, import one here. The recommended image size for Twitter is 1024 x 512px.")));
$yoast_addon->add_options(null, 'Advanced SEO Options', array($yoast_addon->add_field('_yoast_wpseo_meta-robots-noindex', 'Meta Robots Index', 'radio', array('' => 'default', '2' => 'index', '1' => 'noindex'), "This setting can be overwritten by Yoast WordPress SEO's sitewide privacy settings"), $yoast_addon->add_field('_yoast_wpseo_meta-robots-nofollow', 'Meta Robots Nofollow', 'radio', array('' => 'Follow', '1' => 'Nofollow')), $yoast_addon->add_field('_yoast_wpseo_meta-robots-adv', 'Meta Robots Advanced', 'radio', array('' => 'default', 'none' => 'None', 'noodp' => 'NO ODP', 'noydir' => 'NO YDIR', 'noimageindex' => 'No Image Index', 'noarchive' => 'No Archive', 'nosnippet' => 'No Snippet'), 'Advanced meta robots settings for this page.'), $yoast_addon->add_field('_yoast_wpseo_sitemap-include', 'Include in Sitemap', 'radio', array('' => 'Auto detect', 'always' => 'Always include', 'never' => 'Never include'), 'Should this page be in the XML Sitemap at all times, regardless of Robots Meta settings?'), $yoast_addon->add_field('_yoast_wpseo_sitemap-prio', 'Sitemap Priority', 'radio', array('' => 'Automatic Prioritization', '1' => '1 - Highest priority', '0.9' => '0.9', '0.8' => '0.8 - Default for first tier pages', '0.7' => '0.7', '0.6' => '0.6 - Default for second tier pages and posts', '0.5' => '0.5 - Medium priority', '0.4' => '0.4', '0.3' => '0.3', '0.2' => '0.2', '0.1' => '0.1 - Lowest priority'), 'The priority given to this page in the XML sitemap. '), $yoast_addon->add_field('_yoast_wpseo_canonical', 'Canonical URL', 'text', null, 'The canonical URL that this page should point to, leave empty to default to permalink. Cross domain canonical supported too.'), $yoast_addon->add_field('_yoast_wpseo_redirect', '301 Redirect', 'text', null, 'The URL that this page should redirect to.')));
$yoast_addon->set_import_function('yoast_seo_addon_import');
if (function_exists('is_plugin_active')) {
    if (!is_plugin_active("wordpress-seo/wp-seo.php") && !is_plugin_active("wordpress-seo-premium/wp-seo-premium.php")) {
        $yoast_addon->admin_notice('The Yoast WordPress SEO Add-On requires WP All Import <a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_medium=dot-org&utm_campaign=yoast" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>, and the <a href="https://yoast.com/wordpress/plugins/seo/">Yoast WordPress SEO</a> plugin.', array('plugins' => array('wordpress-seo/wp-seo.php')));
    }
    if (is_plugin_active("wordpress-seo/wp-seo.php") || is_plugin_active("wordpress-seo-premium/wp-seo-premium.php")) {
        $yoast_addon->run();
    }
}
function yoast_seo_addon_import($post_id, $data, $import_options)
{
    global $yoast_addon;
    // all fields except for slider and image fields
<?php

/*
Plugin Name: CIO Custom Fields Importer
Plugin URI: http://www.vipp.com.au/shop
Description: Efficiently import large volume of csv or xml data into custom fields created with pods. The premium version allows you to import to any custom fields created by other plugins.  This plugin needs both WP All Import and Pods plugins to import, both freely available. <a href="http://vipp.com.au/shop"> Upgrade to Professional Version </a> for auto media upload, auto matching of relationship fields, user import, WooCommerce customer import, import of pods advanced content types, and more features.
Version: 1.0.1
License: GPLv2
Author: <a href="http://vipp.com.au">VisualData</a>
*/
include "rapid-addon.php";
global $wpdb;
$my_fields = array();
$table_prefix = $wpdb->get_blog_prefix();
$vipp_addon_free = new RapidAddon('PODS Custom Content Types and Fields Free', 'vipp_cashflow_addon_free');
$my_pods = $wpdb->get_results("\n\tSELECT post_name, ID, post_title\n\tFROM " . $table_prefix . "posts\n\tWHERE post_type = '_pods_pod'\n\n        \n\t");
$my_pod_array = array();
if ($my_pods) {
    foreach ($my_pods as $my_pod) {
        if ('post_type' == get_post_meta($my_pod->ID, 'type', true)) {
            $my_pod_array[] = $my_pod->post_name;
            $my_fields[$my_pod->post_name] = array();
        }
    }
}
//print_r($my_pod_array);
if ($my_pods) {
    foreach ($my_pods as $my_pod) {
        if ('post_type' == get_post_meta($my_pod->ID, 'type', true)) {
            $fields_array = array();
            $pods_fields = $wpdb->get_results("\n\t\t\t\tSELECT post_name, post_title, post_content \n\t\t\t\tFROM " . $table_prefix . "posts\n\t\t\t\tWHERE post_type = '_pods_field'\n\t\t\t\t AND post_parent=" . $my_pod->ID);
        // Create the association between two posts
        $set_language_args['trid'] = $default_language_info->trid;
        $set_language_args['source_language_code'] = $default_language;
    }
    // Update language
    do_action('wpml_set_element_language_details', $set_language_args);
    update_slug($post, $slug, $language);
}
function update_slug($post_object, $slug, $language)
{
    // The post slug was changed (because of duplicate)
    if ($post_object->post_name != $slug) {
        wp_update_post(array('ID' => $post_object->ID, 'post_name' => $slug));
    }
}
$multilingual_import_addon = new RapidAddon('Multilingual Import Add-On', 'multilingual_import_addon');
$multilingual_import_addon->add_field('multilingual_import_language', 'Entry Language', 'text');
$multilingual_import_addon->add_field('multilingual_import_common_id', 'Entry Common ID', 'text');
$multilingual_import_addon->set_import_function('multilingual_addon_import');
// display a dismissable notice warning the user to install WP All Import to use the add-on.
// Customize the notice text by passing a string to admin_notice(), i.e. admin_notice("XYZ Theme recommends you install WP All Import (free | pro)")
$multilingual_import_addon->admin_notice();
// the add-on will run for all themes/post types if no arguments are passed to run()
$multilingual_import_addon->run();
function multilingual_addon_import($post_id, $data, $import_options, $articleData)
{
    global $multilingual_import_addon;
    $language = $data['multilingual_import_language'];
    $common_id = $data['multilingual_import_common_id'];
    if ($multilingual_import_addon->can_update_meta('_multilingual_entry_language', $import_options)) {
        echo 'Updating META';
<?php

/*
Plugin Name: WP All Import - Jobify Add-On
Plugin URI: http://www.wpallimport.com/
Description: Supporting imports into the Jobify theme.
Version: 1.0.3
Author: Soflyy
*/
include "rapid-addon.php";
$jobify_addon = new RapidAddon('Jobify Add-On', 'jobify_addon');
$jobify_addon->disable_default_images();
$jobify_addon->add_field('_job_location', 'Location', 'text', null, 'Leave this blank if location is not important');
$jobify_addon->add_field('_company_name', 'Company Name', 'text');
$jobify_addon->add_field('_company_tagline', 'Company Tagline', 'text');
$jobify_addon->add_field('_company_description', 'Company Description', 'text');
$jobify_addon->add_field('_application', 'Application Email or URL', 'text', null, 'This field is required for the "application" area to appear beneath the listing.');
$jobify_addon->add_field('_company_website', 'Company Website', 'text');
$jobify_addon->add_field('_company_logo', 'Company Logo', 'image');
$jobify_addon->add_field('company_featured_image', 'Featured Image', 'image');
// field is _company_video, will 'image' add_field support videos?
$jobify_addon->add_field('video_type', 'Company Video', 'radio', array('external' => array('Externally Hosted', $jobify_addon->add_field('_company_video_url', 'Video URL', 'text')), 'local' => array('Locally Hosted', $jobify_addon->add_field('_company_video_id', 'Upload Video', 'file'))));
$jobify_addon->add_field('_job_expires', 'Listing Expiry Date', 'text', null, 'Import date in any strtotime compatible format.');
$jobify_addon->add_field('_filled', 'Filled', 'radio', array('0' => 'No', '1' => 'Yes'), 'Filled listings will no longer accept applications.');
$jobify_addon->add_field('_featured', 'Featured Listing', 'radio', array('0' => 'No', '1' => 'Yes'), 'Featured listings will be sticky during searches, and can be styled differently.');
$jobify_addon->add_options(null, 'Social Media Options', array($jobify_addon->add_field('_company_facebook', 'Company Facebook', 'text'), $jobify_addon->add_field('_company_twitter', 'Company Twitter', 'text'), $jobify_addon->add_field('_company_linkedin', 'Company LinkedIn', 'text'), $jobify_addon->add_field('_company_google', 'Company Google+', 'text')));
$jobify_addon->set_import_function('jobify_addon_import');
$jobify_addon->admin_notice('The Jobify Add-On requires WP All Import <a href="http://www.wpallimport.com/order-now/?utm_source=free-plugin&utm_medium=dot-org&utm_campaign=jobify" target="_blank">Pro</a> or <a href="http://wordpress.org/plugins/wp-all-import" target="_blank">Free</a>, and the <a href="https://astoundify.com/go/wp-all-import-buy-jobify/">Jobify</a> theme.', array('themes' => array('Jobify')));
$jobify_addon->run(array('themes' => array('Jobify'), 'post_types' => array('job_listing')));
function jobify_addon_import($post_id, $data, $import_options)
{