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: WordPress Show All Posts on a Custom Post Type Archive Page https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/ Version 17 of the amazing and famous Mon, 06 Apr 2020 19:07:14 +0000 hourly 1 https://wordpress.org/?v=7.0 By: Rubika https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-563 Mon, 06 Apr 2020 19:07:14 +0000 https://spigot-16.local/?p=10001#comment-563 In reply to Bryan Hoffman.

No, the main idea is to keep archive page but prevent existing pagination pages that WordPress keep processing with direct access. For example:
example.com/portfolio/page/2

Solved with detecting ‘page’ variable and send 404 headers

]]>
By: Bryan Hoffman https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-562 Mon, 06 Apr 2020 18:59:18 +0000 https://spigot-16.local/?p=10001#comment-562 In reply to RunPower.

Hi RunPower. If you’re using Elementor to show page archives, the snippet above will be of little use to you.

]]>
By: RunPower https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-561 Sun, 05 Apr 2020 07:35:50 +0000 https://spigot-16.local/?p=10001#comment-561 To show all the CPT s elementor wants your to use one of their archive widgets. This gives you options on how to display the archive, however what this widget does is show a collection of mini previews to the CPT s like what you see when you create a blog.

]]>
By: Bryan Hoffman https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-560 Tue, 24 Mar 2020 23:57:14 +0000 https://spigot-16.local/?p=10001#comment-560 In reply to Rubika.

Hi Rubika. By setting posts_per_page to -1 you are telling WordPress to show all posts.

If you are trying to prevent WordPress from creating an archive for a custom post type, you’ll need to set has_archive to false.

I hope that helps.

]]>
By: Rubika https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-559 Tue, 24 Mar 2020 00:21:27 +0000 https://spigot-16.local/?p=10001#comment-559 Hi!

We’re facing the same problem now. The issue is that WordPress in spite of using $query->set(‘posts_per_page’, -1 ); or set_query_var(‘posts_per_archive_page’, -1); still process archive pages!

For example, you need to make single archive page for all the posts you have there:
example.com/movies

and you set posts_per_page -1 in your functions.php, but wordpress will still process and return pages:
example.com/movies/page/2, example.com/movies/page/3 etc.

Now, I’m trying to find out the solution.
If you’ll got some – please write a reply here, I’ll check notify.

]]>
By: Bryan Hoffman https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-558 Fri, 01 Mar 2019 20:34:57 +0000 https://spigot-16.local/?p=10001#comment-558 In reply to Dan.

Hi Dan,

Not quite following you here. Are you looking to filter a user out of the portfolio archive, or simply show ALL posts by an author?

You can also use pre_get_posts to show all posts on an author archive page. Try this in the query: if ( $query->is_author() ) {...}

]]>
By: Dan https://spigot17.spigotdev.com/2018/01/24/wordpress-show-all-posts-on-a-custom-post-type-archive-page/#comment-557 Tue, 26 Feb 2019 15:06:02 +0000 https://spigot-16.local/?p=10001#comment-557 Is there a way of filtering out one of the authors from this scheme? Let’s say a user with the ID=’4′ doesn’t want to have an author archive with portfolios, but only with plain posts. Is it possible?
Thank you.

]]>