
-
AuthorPosts
-
October 16, 2014 at 8:17 am #336609
Hi,
I would like to upload content and setup layout / categories … setting using CSV file, using WP All Import Plugin. Basically, I’m trying to setup all the settings using spreadsheet (so that I don’t miss anything), and then use WPAI to import those settings. WPAI will then dynamically set everything up for me based on my preference in the CSV files. However, I found some fields that I can’t be updated using WPAI plugin.
A while ago I contacted WPAI support to help me setup the parent / child relationship of each page, that can’t automatically be setup using CSV; and they offer me a code (in functions.php) to get around that limitation. Basically what I had to do was to create a custom field, and then use the code below so that the plugin can automatically map the custom field with the “parent” field.
Could you please help me modify the following code, so that it can work with some other fields in the portfolio page? Thank you :)
So, here’s the code:
add_action('pmxi_saved_post', 'set_parent_page', 10, 1); function set_parent_page($pid){ $page = get_post($pid); if ( ! empty($page) ){ $parent_page = get_post_meta($pid, '_tmp_parent_value', true); if ( ! is_numeric($parent_page) ){ $parent = get_page_by_title($parent_page); if (! empty($parent)){ $parent_page = $parent->ID; } } if ( is_numeric($parent_page) ){ wp_update_post(array( 'ID' => $page->ID, 'post_parent' => $parent_page )); } delete_post_meta($pid, '_tmp_parent_value'); } }
In the example above, I have to create a custom field called “_tmp_parent_value”.
What I want to automatically setup in the portfolio item, are the following:
1. Tags
2. Portfolio Categories
3. Layout (Select the desired Page layout)
4. Sidebar Setting (Choose a custom sidebar for this entry)
5. Title Bar Settings (Display the Title Bar with Page Title and Breadcrumb Navigation?)
6. Footer Settings (Display the footer widgets?)
7. Breadcrumb parent page (Select a parent page for this entry. If no page is selected the them will use session data to build the breadcrumb.)Thanks again :)
October 16, 2014 at 9:25 am #336644Nevermind, I’ve found a way to solve this problem by looking at the source code of the web-page.
Thx =)-
This reply was modified 10 years, 8 months ago by
tharzzan.
-
This reply was modified 10 years, 8 months ago by
-
AuthorPosts
- The topic ‘Please help modify code so I can automatically mapped data using WP All Import’ is closed to new replies.