Skip to content

Instantly share code, notes, and snippets.

@manuphatak
Last active July 25, 2018 19:38
Show Gist options
  • Select an option

  • Save manuphatak/9dddd4345ede643c7a30 to your computer and use it in GitHub Desktop.

Select an option

Save manuphatak/9dddd4345ede643c7a30 to your computer and use it in GitHub Desktop.

Revisions

  1. manuphatak revised this gist Mar 18, 2016. 1 changed file with 21 additions and 7 deletions.
    28 changes: 21 additions & 7 deletions convert-posts-to-portfolio.md
    Original file line number Diff line number Diff line change
    @@ -8,15 +8,29 @@ Use the import + export tool and a text editor to replace a few data points.

    # Search + replace details

    Format: `search string` -> `replace string`

    1. `domain="category"` -> `domain="jetpack-portfolio-type"`
    2. `domain="post_tag"` -> `domain="jetpack-portfolio-tag"`
    3. `<wp:post_type><![CDATA[post]]></wp:post_type>` -> `<wp:post_type><![CDATA[jetpack-portfolio]]></wp:post_type>`
    4. the link tag needs converted from `<link>https://example.com/2005/07/project-slug/</link>` to `<link>https://example.com/portfolio/project-slug/</link>`
    - Format
    - S: `search string`
    - R: `replace string`

    1. convert categories to portfolio types
    - S: `domain="category"`
    - R: `domain="jetpack-portfolio-type"`
    2. convert tags to portfolio tags
    - S: `domain="post_tag"`
    - R: `domain="jetpack-portfolio-tag"`
    3. convert post type to jetpack portfolio type
    - S: `<wp:post_type><![CDATA[post]]></wp:post_type>`
    - R: `<wp:post_type><![CDATA[jetpack-portfolio]]></wp:post_type>`
    4. update url link
    - use the regular expression option for this search
    - `<link>https://example.com/\d{4}/\d{2}/` -> `<link>https://example.com/portfolio/`
    5. `<guid isPermaLink="false">https://example.com/?p=` -> `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=`
    - S: `<link>https://example.com/\d{4}/\d{2}/`
    - R: `<link>https://example.com/portfolio/`
    - summary: converts `<link>https://example.com/2005/07/project-slug/</link>` becomes `<link>https://example.com/portfolio/project-slug/</link>`
    5. update guid field
    - S: `<guid isPermaLink="false">https://example.com/?p=`
    - R: `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=`
    - summary: `<guid isPermaLink="false">https://example.com/?p=158</guid>` becomes `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=158</guid>`


    Once you import, WordPress does the rest. WP creates all the tags and types and updates all the ids.
  2. manuphatak revised this gist Mar 18, 2016. 1 changed file with 15 additions and 5 deletions.
    20 changes: 15 additions & 5 deletions convert-posts-to-portfolio.md
    Original file line number Diff line number Diff line change
    @@ -1,12 +1,22 @@
    Using the import/export tool. You export your posts to xml, use a text editor with a search/replace tool to replace a few fields, then you import the updated xml. The things you have to search and replace:
    # Executive summary

    Use the import + export tool and a text editor to replace a few data points.

    1. Export your posts to xml
    2. Use a text editor with a search + replace tool to replace a few fields
    3. Import the updated xml

    # Search + replace details

    Format: `search string` -> `replace string`

    1. `domain="category"` -> `domain="jetpack-portfolio-type"`
    2. `domain="post_tag"` -> `domain="jetpack-portfolio-tag"`
    3. `<wp:post_type><![CDATA[post]]></wp:post_type>` -> `<wp:post_type><![CDATA[jetpack-portfolio]]></wp:post_type>`
    4. the link tag needs converted from `<link>https://example.com/2005/07/project-slug/</link>` to `<link>https://example.com/portfolio/project-slug/</link>`
    - most editors have a regular expression option for the search: `<link>https://example.com/\d{4}/\d{2}/` -> `<link>https://example.com/portfolio/`
    5. `<guid isPermaLink="false">https://example.com/?p=158</guid>` becomes `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=158</guid>`
    - `<guid isPermaLink="false">https://example.com/?p=` -> `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=`
    - use the regular expression option for this search
    - `<link>https://example.com/\d{4}/\d{2}/` -> `<link>https://example.com/portfolio/`
    5. `<guid isPermaLink="false">https://example.com/?p=` -> `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=`


    Once you import, WordPress does the rest -- it creates all the tags and types, and updates all the ids.
    Once you import, WordPress does the rest. WP creates all the tags and types and updates all the ids.
  3. manuphatak created this gist Mar 18, 2016.
    12 changes: 12 additions & 0 deletions convert-posts-to-portfolio.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    Using the import/export tool. You export your posts to xml, use a text editor with a search/replace tool to replace a few fields, then you import the updated xml. The things you have to search and replace:

    1. `domain="category"` -> `domain="jetpack-portfolio-type"`
    2. `domain="post_tag"` -> `domain="jetpack-portfolio-tag"`
    3. `<wp:post_type><![CDATA[post]]></wp:post_type>` -> `<wp:post_type><![CDATA[jetpack-portfolio]]></wp:post_type>`
    4. the link tag needs converted from `<link>https://example.com/2005/07/project-slug/</link>` to `<link>https://example.com/portfolio/project-slug/</link>`
    - most editors have a regular expression option for the search: `<link>https://example.com/\d{4}/\d{2}/` -> `<link>https://example.com/portfolio/`
    5. `<guid isPermaLink="false">https://example.com/?p=158</guid>` becomes `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=158</guid>`
    - `<guid isPermaLink="false">https://example.com/?p=` -> `<guid isPermaLink="false">https://example.com/?post_type=jetpack-portfolio&#038;p=`


    Once you import, WordPress does the rest -- it creates all the tags and types, and updates all the ids.