require_once ABSPATH . 'wp-admin/includes/image.php'; $spec = json_decode('[{"slug":"moneyminder","title":"MoneyMinder","year":2025,"site_url":"https://moneyminder.com","deliverables":["content_strategy","custom_design","wp_development"],"note":"Spigot has been working with the Moneyminder team for nearly ten years now, and we couldn\'t have been happier when they asked us back to start an in-situ redesign.","desktop":"https://spigotdesign.com/wp-content/uploads/2025/05/mm-home.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2025/05/mm-mobile-menu.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2025/05/people_mgmt.webp","https://spigotdesign.com/wp-content/uploads/2025/05/mm-home-1.webp","https://spigotdesign.com/wp-content/uploads/2025/05/moneyminder-pricing.webp","https://spigotdesign.com/wp-content/uploads/2025/05/mm-services-screen.webp","https://spigotdesign.com/wp-content/uploads/2025/05/mm-mobile-menu.webp","https://spigotdesign.com/wp-content/uploads/2025/05/moneyminder-header.webp"]},{"slug":"power-of-closure","title":"Power of Closure","year":2025,"site_url":"https://powerofclosure.com","deliverables":["brand_guide","content_strategy","custom_design","logo_design","wp_development"],"note":"Working with Dr. Gary McClain on the Power of Closure project allowed us to bring his compassionate approach to healing and personal growth to life online.","desktop":"https://spigotdesign.com/wp-content/uploads/2025/02/poc-home-page.webp","mobile":"","gallery":["https://spigotdesign.com/wp-content/uploads/2025/02/speaking-engagements-scaled.webp","https://spigotdesign.com/wp-content/uploads/2025/02/power-of-closure-home.webp","https://spigotdesign.com/wp-content/uploads/2025/02/poc-you-are-not-alone.webp","https://spigotdesign.com/wp-content/uploads/2025/02/poc-book.webp","https://spigotdesign.com/wp-content/uploads/2025/02/poc-relationship-coaching-scaled.webp"]},{"slug":"fj-management","title":"FJ Management","year":2025,"site_url":"https://fjmgt.com/","deliverables":["content_strategy","custom_design","hosting","wp_development"],"note":"The legacy of FJ Management comes to life through a digital presence that balances its business acumen with its philanthropic heart.","desktop":"https://spigotdesign.com/wp-content/uploads/2025/02/FJM-hero.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2025/02/fjm-home-mobile.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2025/02/fjm-energy-2.webp","https://spigotdesign.com/wp-content/uploads/2025/02/fjm-home-mobile.webp","https://spigotdesign.com/wp-content/uploads/2025/02/fjm-business-dev.webp","https://spigotdesign.com/wp-content/uploads/2025/02/fjm-work-with-us.webp","https://spigotdesign.com/wp-content/uploads/2025/02/fjm-philanthropy.webp","https://spigotdesign.com/wp-content/uploads/2025/02/fjm-history-scaled.webp"]},{"slug":"pathway-group","title":"Pathway Group","year":2025,"site_url":"https://pathwaygroup.co/","deliverables":["content_strategy","custom_design","hosting","wp_development"],"note":"The Pathway Group stands as a trusted partner in organizational transformation, bringing strategic insight to nonprofits and businesses across the nation from their base in Utah.","desktop":"https://spigotdesign.com/wp-content/uploads/2025/02/pathway-group-home.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2025/02/pathway-mobile-home.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2025/02/pathway-fundraising-scaled.webp","https://spigotdesign.com/wp-content/uploads/2025/02/pathway-mobile-home.webp","https://spigotdesign.com/wp-content/uploads/2025/02/pathway-group-mobile-execsearch.webp","https://spigotdesign.com/wp-content/uploads/2025/02/pathway-mobile-footer.webp","https://spigotdesign.com/wp-content/uploads/2025/02/pathway-mobile-about.webp","https://spigotdesign.com/wp-content/uploads/2025/02/pathway-group-about-scaled.webp"]}]', true); if (!$spec) { echo 'SPEC DECODE FAIL'; return; } $side = static fn($url, $desc) => (static function ($url, $desc) { $resp = wp_remote_get($url, ['timeout' => 30, 'headers' => ['User-Agent' => 'Mozilla/5.0 Spigot17Importer']]); if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) !== 200) return 0; $body = wp_remote_retrieve_body($resp); if (!$body) return 0; $up = wp_upload_bits(basename(parse_url($url, PHP_URL_PATH)), null, $body); if (!empty($up['error'])) return 0; $att = wp_insert_attachment(['post_mime_type' => wp_check_filetype($up['file'])['type'], 'post_title' => $desc, 'post_status' => 'inherit'], $up['file']); if (is_wp_error($att) || !$att) return 0; wp_update_attachment_metadata($att, wp_generate_attachment_metadata($att, $up['file'])); return $att; })($url, $desc); foreach ($spec as $p) { if (get_page_by_path($p['slug'], OBJECT, 'work')) { echo $p['slug'] . ': exists' . "\n"; continue; } $pid = wp_insert_post(['post_type' => 'work', 'post_status' => 'draft', 'post_title' => $p['title'], 'post_name' => $p['slug']]); if (is_wp_error($pid)) { echo $p['slug'] . ': POST FAIL' . "\n"; continue; } $desk = $p['desktop'] ? $side($p['desktop'], $p['title'] . ' desktop') : 0; $mob = $p['mobile'] ? $side($p['mobile'], $p['title'] . ' mobile') : 0; $g = []; foreach ((array) $p['gallery'] as $u) { $a = $side($u, $p['title'] . ' screenshot'); if ($a) $g[] = $a; } update_field('client_name', $p['title'], $pid); if (!empty($p['year'])) update_field('launch_year', $p['year'], $pid); if (!empty($p['site_url'])) update_field('site_url', $p['site_url'], $pid); if (!empty($p['deliverables'])) update_field('deliverables', $p['deliverables'], $pid); if (!empty($p['note'])) update_field('build_note', $p['note'], $pid); if ($desk) { update_field('desktop_screenshot', $desk, $pid); set_post_thumbnail($pid, $desk); } if ($mob) update_field('mobile_screenshot', $mob, $pid); if ($g) update_field('gallery', $g, $pid); update_field('hosted_on_cinch', 1, $pid); echo $p['slug'] . ': post ' . $pid . ' desk ' . $desk . ' mob ' . $mob . ' gal ' . count($g) . "\n"; } require_once ABSPATH . 'wp-admin/includes/image.php'; $spec = json_decode('[{"slug":"utah-donor-collective","title":"Utah Donor Collective","year":2024,"site_url":"https://utahdonorcollaborative.com/","deliverables":["brand_guide","content_strategy","custom_design","logo_design","wp_development"],"note":"There aren\'t too many people who\'d look to Utah as the center of diversity in politics.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/07/Utah-Donor-Collaborative-overview.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2024/07/Our-Mission-Utah-Donor-Collaborative-2-scaled.webp","https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-1.webp","https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-2-1.webp","https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-3.webp","https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-4.webp","https://spigotdesign.com/wp-content/uploads/2024/07/Utah-Donor-Collaborative-overview-footer-2.webp"]},{"slug":"armentum-partners","title":"Armentum Partners","year":2024,"site_url":"https://armentumpartners.com/transactions/","deliverables":["brand_guide","content_strategy","custom_design","logo_design","wp_development"],"note":"This is the second website we have designed for Armentum.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/06/armentum-homepage.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2024/06/mobile-menu-armentum-partners.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2024/06/transactions-armentum-partners-scaled.webp","https://spigotdesign.com/wp-content/uploads/2024/06/mobile-menu-armentum-partners.webp","https://spigotdesign.com/wp-content/uploads/2024/06/mobile-icons-armentum-partners.webp","https://spigotdesign.com/wp-content/uploads/2024/06/mobile-transactions-armentum-partners.webp","https://spigotdesign.com/wp-content/uploads/2024/06/mobile-blog-armentum-partners.webp","https://spigotdesign.com/wp-content/uploads/2024/06/home-page-footer-armentum-partners.webp"]},{"slug":"bond-design-company","title":"Bond Design Company","year":2024,"site_url":"https://bonddesigncompany.com/portfolio","deliverables":["content_strategy","custom_design","hosting","wp_development"],"note":"Have you ever worked with someone whose work you are in total awe of, maybe felt a little intimidated by their talent?","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/bond-desktop-home.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/bond-mobile-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/bond-desktop-interior.webp","https://spigotdesign.com/wp-content/uploads/2023/10/bond-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/bond-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/bond-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/bond-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/bond-desktop-contact.webp"]},{"slug":"american-academy-innovation","title":"American Academy of Innovation","year":2024,"site_url":"https://aaiutah.org","deliverables":["brand_guide","content_strategy","copywriting","custom_design","hosting","wp_development"],"note":"When a school is described as innovative, embracing change, facing failures and challenging potential, you\'re definitely not looking at a standard educational institution.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/aai-utah-desktop-home-1.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/aai-mobile-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/aai-utah-desktop-footer.webp","https://spigotdesign.com/wp-content/uploads/2023/10/aai-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/aai-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/aai-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/aai-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/aai-tablet-interior.webp"]}]', true); if (!$spec) { echo 'SPEC DECODE FAIL'; return; } $side = static fn($url, $desc) => (static function ($url, $desc) { $resp = wp_remote_get($url, ['timeout' => 30, 'headers' => ['User-Agent' => 'Mozilla/5.0 Spigot17Importer']]); if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) !== 200) return 0; $body = wp_remote_retrieve_body($resp); if (!$body) return 0; $up = wp_upload_bits(basename(parse_url($url, PHP_URL_PATH)), null, $body); if (!empty($up['error'])) return 0; $att = wp_insert_attachment(['post_mime_type' => wp_check_filetype($up['file'])['type'], 'post_title' => $desc, 'post_status' => 'inherit'], $up['file']); if (is_wp_error($att) || !$att) return 0; wp_update_attachment_metadata($att, wp_generate_attachment_metadata($att, $up['file'])); return $att; })($url, $desc); foreach ($spec as $p) { if (get_page_by_path($p['slug'], OBJECT, 'work')) { echo $p['slug'] . ': exists' . "\n"; continue; } $pid = wp_insert_post(['post_type' => 'work', 'post_status' => 'draft', 'post_title' => $p['title'], 'post_name' => $p['slug']]); if (is_wp_error($pid)) { echo $p['slug'] . ': POST FAIL' . "\n"; continue; } $desk = $p['desktop'] ? $side($p['desktop'], $p['title'] . ' desktop') : 0; $mob = $p['mobile'] ? $side($p['mobile'], $p['title'] . ' mobile') : 0; $g = []; foreach ((array) $p['gallery'] as $u) { $a = $side($u, $p['title'] . ' screenshot'); if ($a) $g[] = $a; } update_field('client_name', $p['title'], $pid); if (!empty($p['year'])) update_field('launch_year', $p['year'], $pid); if (!empty($p['site_url'])) update_field('site_url', $p['site_url'], $pid); if (!empty($p['deliverables'])) update_field('deliverables', $p['deliverables'], $pid); if (!empty($p['note'])) update_field('build_note', $p['note'], $pid); if ($desk) { update_field('desktop_screenshot', $desk, $pid); set_post_thumbnail($pid, $desk); } if ($mob) update_field('mobile_screenshot', $mob, $pid); if ($g) update_field('gallery', $g, $pid); update_field('hosted_on_cinch', 1, $pid); echo $p['slug'] . ': post ' . $pid . ' desk ' . $desk . ' mob ' . $mob . ' gal ' . count($g) . "\n"; } require_once ABSPATH . 'wp-admin/includes/image.php'; $spec = json_decode('[{"slug":"outkast-tackle","title":"Outkast Tackle","year":2024,"site_url":"https://outkasttackle.com/","deliverables":["content_strategy","copywriting","custom_design","ecommerce","seo_setup"],"note":"Tradition. Craftsmanship. Thoughtful design.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/01/marquee-outkast-tackle.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2024/01/outkast-home-mobile.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2024/01/outkast-product.webp","https://spigotdesign.com/wp-content/uploads/2024/01/outkast-home-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/footer-outkast-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/shop-outkast-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/rig-chart-outkast-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/outkast-pro-staff.webp"]},{"slug":"stereotomic","title":"Stereotomic","year":2023,"site_url":"https://stereotomic.space/","deliverables":["brand_guide","content_strategy","custom_design","logo_design","wp_development"],"note":"Our partnership with the Stereotomic team brought their visionary architectural practice to life in the digital space.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-home.webp","mobile":"","gallery":["https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-work.webp","https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-project.webp","https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-work-1.webp","https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-about.webp","https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-single-project.webp","https://spigotdesign.com/wp-content/uploads/2023/11/stereotomic-about-desktop.webp"]},{"slug":"lake-house-academy","title":"Lake House Academy","year":2023,"site_url":"https://lakehouseacademy.com","deliverables":["brand_guide","content_strategy","copywriting","custom_design","logo_design","wp_development"],"note":"There are a few industries that aren\'t known for well-designed or easy-to-use websites.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-desktop-home.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-mobile-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/life-at-lakehouse.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lakeouse-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lakehouse-tablet.webp"]},{"slug":"new-haven","title":"New Haven","year":2023,"site_url":"https://www.newhavenrtc.com","deliverables":["content_strategy","custom_design","logo_design","seo_setup","wp_development"],"note":"Imagine being an organization without the independence to make marketing decisions because of ownership hierarchies.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/nh-desktop-scaled.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/newhaven-mobile-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/nh-campuses.webp","https://spigotdesign.com/wp-content/uploads/2023/10/newhaven-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/newhaven-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/newhaven-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/newhaven-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/nh-leadership-desktop.webp"]}]', true); if (!$spec) { echo 'SPEC DECODE FAIL'; return; } $side = static fn($url, $desc) => (static function ($url, $desc) { $resp = wp_remote_get($url, ['timeout' => 30, 'headers' => ['User-Agent' => 'Mozilla/5.0 Spigot17Importer']]); if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) !== 200) return 0; $body = wp_remote_retrieve_body($resp); if (!$body) return 0; $up = wp_upload_bits(basename(parse_url($url, PHP_URL_PATH)), null, $body); if (!empty($up['error'])) return 0; $att = wp_insert_attachment(['post_mime_type' => wp_check_filetype($up['file'])['type'], 'post_title' => $desc, 'post_status' => 'inherit'], $up['file']); if (is_wp_error($att) || !$att) return 0; wp_update_attachment_metadata($att, wp_generate_attachment_metadata($att, $up['file'])); return $att; })($url, $desc); foreach ($spec as $p) { if (get_page_by_path($p['slug'], OBJECT, 'work')) { echo $p['slug'] . ': exists' . "\n"; continue; } $pid = wp_insert_post(['post_type' => 'work', 'post_status' => 'draft', 'post_title' => $p['title'], 'post_name' => $p['slug']]); if (is_wp_error($pid)) { echo $p['slug'] . ': POST FAIL' . "\n"; continue; } $desk = $p['desktop'] ? $side($p['desktop'], $p['title'] . ' desktop') : 0; $mob = $p['mobile'] ? $side($p['mobile'], $p['title'] . ' mobile') : 0; $g = []; foreach ((array) $p['gallery'] as $u) { $a = $side($u, $p['title'] . ' screenshot'); if ($a) $g[] = $a; } update_field('client_name', $p['title'], $pid); if (!empty($p['year'])) update_field('launch_year', $p['year'], $pid); if (!empty($p['site_url'])) update_field('site_url', $p['site_url'], $pid); if (!empty($p['deliverables'])) update_field('deliverables', $p['deliverables'], $pid); if (!empty($p['note'])) update_field('build_note', $p['note'], $pid); if ($desk) { update_field('desktop_screenshot', $desk, $pid); set_post_thumbnail($pid, $desk); } if ($mob) update_field('mobile_screenshot', $mob, $pid); if ($g) update_field('gallery', $g, $pid); update_field('hosted_on_cinch', 1, $pid); echo $p['slug'] . ': post ' . $pid . ' desk ' . $desk . ' mob ' . $mob . ' gal ' . count($g) . "\n"; } require_once ABSPATH . 'wp-admin/includes/image.php'; $spec = json_decode('[{"slug":"mountainlands-community-housing-trust","title":"Mountainlands Community Housing Trust","year":2023,"site_url":"https://housinghelp.org","deliverables":["brand_guide","content_strategy","custom_design","hosting","wp_development"],"note":"Sometimes Puzzle Season \\u2014 that peaceful time between Thanksgiving and New Year\'s \\u2014 stretches into June.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-desktop.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-mobile-2.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/housing-for-people-not-profit.webp","https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/mountainlands-interior.webp"]},{"slug":"lumen-scholar-institute","title":"Lumen Scholar Institute","year":2022,"site_url":"https://lumenscholar.org/","deliverables":["brand_guide","content_strategy","copywriting","custom_design","hosting","wp_development"],"note":"While Dorothy once implored \\u201cThere\\u2019s no place like home,\\u201d today\'s students require an expanded definition of this sentiment.","desktop":"https://spigotdesign.com/wp-content/uploads/2023/10/lumen-desktop-home.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2023/10/lumenscholar-mobile-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2023/10/lumen-desktop-footer-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lumenscholar-mobile-1.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lumenscholar-mobile-3.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lumenscholar-mobile-4.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lumenscholar-mobile-2.webp","https://spigotdesign.com/wp-content/uploads/2023/10/lumen-desktop-interior.webp"]},{"slug":"beehive-buildings","title":"Beehive Buildings","year":2021,"site_url":"https://beehivebuildings.com/","deliverables":["content_strategy","custom_design","hosting","wp_development"],"note":"If you build it, they will come. That goes for both well-designed, SEO-optimized websites and quality pole barns at an affordable price.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/01/Beehive-Buildings-Custom-Pole-Barn-Builders.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2024/01/beehive-marquee-mobile.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2024/01/Archives-Projects-Beehive-Buildings.webp","https://spigotdesign.com/wp-content/uploads/2024/01/beehive-marquee-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/beehive-footer-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/beehive-interior-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/beehive-blog-mobile.webp","https://spigotdesign.com/wp-content/uploads/2024/01/Beehive-Buildings-home.webp"]},{"slug":"elliott-workgroup","title":"Elliott Workgroup","year":2021,"site_url":"https://elliottworkgroup.com","deliverables":["content_strategy","custom_design","hosting","wp_development"],"note":"Since 2002, this forward-thinking architectural design firm has engrained its philosophy of doing good for the community, for visual participants, and for the planet into the very fibers of Park City and Utah at large.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/07/Elliott-Workgroup-homepage.webp","mobile":"https://spigotdesign.com/wp-content/uploads/2024/07/eliott-home-mobile-view.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2021/12/elliott-worgroup-project.webp","https://spigotdesign.com/wp-content/uploads/2024/07/eliott-home-mobile-view.webp","https://spigotdesign.com/wp-content/uploads/2024/07/home-mobile-menu-open.webp","https://spigotdesign.com/wp-content/uploads/2024/07/eliott-projects-mobile-view.webp","https://spigotdesign.com/wp-content/uploads/2024/07/eliott-projects.webp","https://spigotdesign.com/wp-content/uploads/2024/08/elliott-workgroup-blog-archive.webp"]}]', true); if (!$spec) { echo 'SPEC DECODE FAIL'; return; } $side = static fn($url, $desc) => (static function ($url, $desc) { $resp = wp_remote_get($url, ['timeout' => 30, 'headers' => ['User-Agent' => 'Mozilla/5.0 Spigot17Importer']]); if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) !== 200) return 0; $body = wp_remote_retrieve_body($resp); if (!$body) return 0; $up = wp_upload_bits(basename(parse_url($url, PHP_URL_PATH)), null, $body); if (!empty($up['error'])) return 0; $att = wp_insert_attachment(['post_mime_type' => wp_check_filetype($up['file'])['type'], 'post_title' => $desc, 'post_status' => 'inherit'], $up['file']); if (is_wp_error($att) || !$att) return 0; wp_update_attachment_metadata($att, wp_generate_attachment_metadata($att, $up['file'])); return $att; })($url, $desc); foreach ($spec as $p) { if (get_page_by_path($p['slug'], OBJECT, 'work')) { echo $p['slug'] . ': exists' . "\n"; continue; } $pid = wp_insert_post(['post_type' => 'work', 'post_status' => 'draft', 'post_title' => $p['title'], 'post_name' => $p['slug']]); if (is_wp_error($pid)) { echo $p['slug'] . ': POST FAIL' . "\n"; continue; } $desk = $p['desktop'] ? $side($p['desktop'], $p['title'] . ' desktop') : 0; $mob = $p['mobile'] ? $side($p['mobile'], $p['title'] . ' mobile') : 0; $g = []; foreach ((array) $p['gallery'] as $u) { $a = $side($u, $p['title'] . ' screenshot'); if ($a) $g[] = $a; } update_field('client_name', $p['title'], $pid); if (!empty($p['year'])) update_field('launch_year', $p['year'], $pid); if (!empty($p['site_url'])) update_field('site_url', $p['site_url'], $pid); if (!empty($p['deliverables'])) update_field('deliverables', $p['deliverables'], $pid); if (!empty($p['note'])) update_field('build_note', $p['note'], $pid); if ($desk) { update_field('desktop_screenshot', $desk, $pid); set_post_thumbnail($pid, $desk); } if ($mob) update_field('mobile_screenshot', $mob, $pid); if ($g) update_field('gallery', $g, $pid); update_field('hosted_on_cinch', 1, $pid); echo $p['slug'] . ': post ' . $pid . ' desk ' . $desk . ' mob ' . $mob . ' gal ' . count($g) . "\n"; } require_once ABSPATH . 'wp-admin/includes/image.php'; $spec = json_decode('[{"slug":"park-city-library","title":"Park City Library","year":2021,"site_url":"https://utahdonorcollaborative.com/","deliverables":["brand_guide","content_strategy","custom_design","logo_design","wp_development"],"note":"The Park City Library has been a client of ours for many years, and we\'ve built more than one iteration of its site.","desktop":"https://spigotdesign.com/wp-content/uploads/2024/07/Logo_of_the_Park_City_Library.svg.png","mobile":"https://spigotdesign.com/wp-content/uploads/2024/07/home-mobile-screenshot-1.webp","gallery":["https://spigotdesign.com/wp-content/uploads/2024/07/park-city-library-homepage.webp","https://spigotdesign.com/wp-content/uploads/2024/07/park-city-library-homepage-screenshot-3.webp","https://spigotdesign.com/wp-content/uploads/2024/07/home-mobile-screenshot-1.webp","https://spigotdesign.com/wp-content/uploads/2024/07/home-mobile-screenshot-2.webp","https://spigotdesign.com/wp-content/uploads/2024/07/insidepage-mobile-screenshot-1.webp","https://spigotdesign.com/wp-content/uploads/2024/07/utah-mobile-view-4.webp","https://spigotdesign.com/wp-content/uploads/2024/07/Storytimes-Park-City-Library-scaled.webp"]}]', true); if (!$spec) { echo 'SPEC DECODE FAIL'; return; } $side = static fn($url, $desc) => (static function ($url, $desc) { $resp = wp_remote_get($url, ['timeout' => 30, 'headers' => ['User-Agent' => 'Mozilla/5.0 Spigot17Importer']]); if (is_wp_error($resp) || wp_remote_retrieve_response_code($resp) !== 200) return 0; $body = wp_remote_retrieve_body($resp); if (!$body) return 0; $up = wp_upload_bits(basename(parse_url($url, PHP_URL_PATH)), null, $body); if (!empty($up['error'])) return 0; $att = wp_insert_attachment(['post_mime_type' => wp_check_filetype($up['file'])['type'], 'post_title' => $desc, 'post_status' => 'inherit'], $up['file']); if (is_wp_error($att) || !$att) return 0; wp_update_attachment_metadata($att, wp_generate_attachment_metadata($att, $up['file'])); return $att; })($url, $desc); foreach ($spec as $p) { if (get_page_by_path($p['slug'], OBJECT, 'work')) { echo $p['slug'] . ': exists' . "\n"; continue; } $pid = wp_insert_post(['post_type' => 'work', 'post_status' => 'draft', 'post_title' => $p['title'], 'post_name' => $p['slug']]); if (is_wp_error($pid)) { echo $p['slug'] . ': POST FAIL' . "\n"; continue; } $desk = $p['desktop'] ? $side($p['desktop'], $p['title'] . ' desktop') : 0; $mob = $p['mobile'] ? $side($p['mobile'], $p['title'] . ' mobile') : 0; $g = []; foreach ((array) $p['gallery'] as $u) { $a = $side($u, $p['title'] . ' screenshot'); if ($a) $g[] = $a; } update_field('client_name', $p['title'], $pid); if (!empty($p['year'])) update_field('launch_year', $p['year'], $pid); if (!empty($p['site_url'])) update_field('site_url', $p['site_url'], $pid); if (!empty($p['deliverables'])) update_field('deliverables', $p['deliverables'], $pid); if (!empty($p['note'])) update_field('build_note', $p['note'], $pid); if ($desk) { update_field('desktop_screenshot', $desk, $pid); set_post_thumbnail($pid, $desk); } if ($mob) update_field('mobile_screenshot', $mob, $pid); if ($g) update_field('gallery', $g, $pid); update_field('hosted_on_cinch', 1, $pid); echo $p['slug'] . ': post ' . $pid . ' desk ' . $desk . ' mob ' . $mob . ' gal ' . count($g) . "\n"; } Comments on: Solved: Local by Flywheel Stuck on Provisioning (Installing WordPress) https://spigot17.spigotdev.com/2018/06/07/solved-local-by-flywheel-stuck-on-provisioning-installing-wordpress/ Version 17 of the amazing and famous Thu, 07 Jun 2018 17:58:19 +0000 hourly 1 https://wordpress.org/?v=7.0