Support » Plugin: CSV Importer » [Plugin: CSV Importer] Category description

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor dvkob

    (@dvkob)

    Ruriko: Not yet, but it will be trivial to add. I’ll try to update the plugin soon.

    pekarna12

    (@pekarna12)

    Has this been added yet?

    Plugin Contributor dvkob

    (@dvkob)

    pekarna12: Not yet. Other things keep getting in the way 🙂

    I wanted to import Descriptions for each Term of a Custom Taxonomy. Here is what I did. Hope it helps someone.

    Using CSV Importer plugin Version 0.3.5.

    In my CSV file, add the Description content after the Category name, separated by an arbitrary delimited “::”, so it looks like this:

    csv_post_title,csv_post_type,csv_ctax_my-custom-taxonomy
    import-title,my-post-type,"MY PARENT CAT::My parent-cat description,MY CHILD SUBCAT 1::My sub-cat1 description"
    import-title,my-post-type,"MY PARENT CAT::My parent-cat description,MY CHILD SUBCAT 2::My sub-cat2 description"

    (note: it’s probably not ideal/necessary to have the parent category description more than once, but I didn’t test without it.)

    EDIT MY csv_importer.php FILE
    (Yes, this is hacking the plugin code, so my changes will be lost in any future updates of the plugin, and will require them to be implemented again.)

    Find line 362
    if ($parent) {
    after that, add

    $tz_parent_array = explode("::",$parent);
    $parent_desc = $tz_parent_array[1];
    $parent = $tz_parent_array[0];

    Change (what was) line 366 from
    $parent_info = wp_insert_term($parent, $taxonomy);
    to
    $parent_info = wp_insert_term($parent, $taxonomy, array('description' => $parent_desc));

    Find
    if ($parent_ok) {
    after that, add

    $tz_child_array = explode("::",$child);
    $child_desc = $tz_child_array[1];
    $child = $tz_child_array[0];

    Change
    array('parent' => $parent_id));
    to

    array(
    	'parent' => $parent_id,
    	'description' => $child_desc
    ));

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: CSV Importer] Category description’ is closed to new replies.