This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// data from https://gist.github.com/andyj/7108917 | |
$array = [ | |
'44' => 'UK (+44)', | |
'1' => 'USA (+1)', | |
'213' => 'Algeria (+213)', | |
'376' => 'Andorra (+376)', | |
'244' => 'Angola (+244)', | |
'1264' => 'Anguilla (+1264)', | |
'1268' => 'Antigua & Barbuda (+1268)', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$file = '/path/to/file.png'; | |
$filename = basename($file); | |
$upload_file = wp_upload_bits($filename, null, file_get_contents($file)); | |
if (!$upload_file['error']) { | |
$wp_filetype = wp_check_filetype($filename, null ); | |
$attachment = array( | |
'post_mime_type' => $wp_filetype['type'], | |
'post_parent' => $parent_post_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Helper Functions | |
/** | |
* Programmatically creates a WordPress post based on the incoming parameters. | |
* | |
* Note: This function may need some additional work if you're dealing with non-English languages. | |
* | |
* @param string $title The title of the page as presented to the users | |
* @param string $slug The slug used to access the page via the URL |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"CO":[ | |
{ | |
"product-name":"MEN'S BETTER THAN NAKED™ JACKET", | |
"product-image-url":"http://images.thenorthface.com/is/image/TheNorthFace/236x204_CLR/mens-better-than-naked-jacket-AVMH_LC9_hero.png", | |
"header-top-right-text":"Shop All", | |
"header-top-left-text":"Men's", | |
"product-url":"http://www.thenorthface.com/catalog/sc-gear/men-39-s-better-than-naked-8482-jacket.html", | |
"header-top-right-url":"http://www.thenorthface.com/en_US/shop-mens/", | |
"product-cta-text":"Shop Now" |