View
1.282
Download
0
Category
Preview:
Citation preview
G E TT I N G T O W O R D P R E S S
WP CA MPU S 2016
https://www.flickr.com/photos/rogersmj/3529152061/
Stephanie Leary@slearysleary.me/wpcampus2016
M OV IN G S U C K S .
https://www.flickr.com/photos/picturesofthings/3276020078/
I M PO RT PLU G I N SHTTP : / / C O DE X . W O R DP R E S S . O RG/ I MP O RT I N G_ C O N T E N T
https://www.flickr.com/photos/sisterdanger/24773994365/
I M PO RT SE RV I C E S
https://www.flickr.com/photos/travosaurus/14805424435
IM P O RT A N Y T H IN GYOU GOT T H I S
T I DY DATA B A S E
https://www.flickr.com/photos/telstar/6859351675/
W P A LL I M P O RTOP T IO N 1 :
W P A LL I M P O RTOP T IO N 1 :
W P A LL I M P O RTOP T IO N 1 :
W P A LL I M P O RTOP T IO N 1 :
W P A LL I M P O RTOP T IO N 1 :
W P A LL I M P O RTOP T IO N 1 :
S TAT I C F I LE S
https://www.flickr.com/photos/catjannik/381162608/
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
H T M L I M P O RTOP T IO N 2 :
D IY
https://www.flickr.com/photos/catjannik/381162608
DI Y I M PO RT E R
1. Fetch data from <somewhere>
2. Loop through each item
3. Assemble pieces into $post array
4. wp_insert_post()
5. wp_set_post_terms()
6. add_post_meta()
O PT I ON 3 :
DI Y I M PO RT E R
foreach ( $things as $thing ) { $post = array(); $post['post_content'] = $thing->content; $post['post_status'] = $thing->status; $post['post_title'] = $thing->title; wp_insert_post( $post );}
O PT I ON 3 :
R E A DY T O G O ?
https://www.flickr.com/photos/brad_frost/9159754008/
1 . C O N TE N T M O D E L
MIRROR OR IMPROVE:
• Custom post types
• Custom fields
• Taxonomies
1 . C O N TE N T M O D E L
INCLUDE FIELDS:
• IDs
• Paths
• Author ID or email
1 . C O N T E N T M O D E LDIY C O DE
1 . C O N T E N T M O D E LCUS T O M PO S T T Y P E U I P LUG I N
1 . C O N T E N T M O D E LADVAN CED CU ST O M F IE L DS PLU G IN
2 . E X P O RT
https://www.flickr.com/photos/booleansplit/7286682184/
2 . E XPO RT
CHECK:
• HTML vs plain text fields
• Date formatting
• Character encoding
• Commas in tags / categories / terms
• Relative link & image paths
3 . S TAG I N G
• Give PHP ALL THE MEMORY
• Turn off plugins, publicize tools, etc.
• Back up both databases
• Warn system administrators
G O
A S SE SSTH E M E SS
https://www.flickr.com/photos/glenscott/3388493598/
PO ST- I M PO RT PLU G I N S
• Search and Replace
• Post Type Switcher / Convert Post Types
• Term Management Tools
• Add Linked Images to Gallery
• Admin Columns
• Content Audit
C L E A N U P E XA M PL E
1. WP All Export custom field
2. WP All Import the field as term
3. Merge duplicates & typos w/Term Management Tools
A D M I N C O LU M N S PLU G I N
FAS T R E V IE W IN G
R E D I R E C T S
https://www.flickr.com/photos/nnova/8227348112/
R E D I R E C T O PT I O N S
1. .htaccess
2. Redirection plugin
3. DIY codehttp://stephanieleary.com/?p=8220
. h t a c c e s s
R E D I R E C T I O N P LU G I N
DI Y R E D I R E C T S
add_filter( 'redirect_canonical', 'my_404_no_guessing', 10, 2 );
function my_404_no_guessing( $redirect_url, $request_url ) { if ( is_404() ) {
$posts = get_posts( array( 'meta_key' => 'URL_before_HTML_Import','meta_value' => $request_url, 'post_type' => 'any','posts_per_page' => 1,'fields' => 'ids',
) );if ( $posts ) {
$redirect_url = get_permalink( array_pop( $posts ) );}else
return false; } return $redirect_url;}
HT ML IMPO RT
add_filter( 'redirect_canonical', 'my_404_no_guessing', 10, 2 );
function my_404_no_guessing( $redirect_url, $request_url ) { if ( is_404() ) {
$posts = get_posts( array( 'meta_key' => 'drupal_path','meta_value' => parse_url( $request_url,
PHP_URL_PATH ), 'post_type' => 'any','posts_per_page' => 1,'fields' => 'ids',
) );if ( $posts ) {
$redirect_url = get_permalink( array_pop( $posts ) );}else
return false; } return $redirect_url;}
DI Y R E D I R E C T SDR UPAL / W P A LL IMPO RT
S TE P H AN I E LE A RY. C OM @S LE ARY
Recommended