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: Smooth Scroll Offset Anchor Links with CSS https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/ Version 17 of the amazing and famous Fri, 12 Aug 2022 00:38:02 +0000 hourly 1 https://wordpress.org/?v=7.0 By: Lee James https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-620 Fri, 12 Aug 2022 00:38:02 +0000 https://spigot-16.local/?p=19374#comment-620 In reply to Lee James.

scroll-top-margin should be scroll-margin-top (excuse the typo).

]]>
By: Lee James https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-619 Fri, 12 Aug 2022 00:32:40 +0000 https://spigot-16.local/?p=19374#comment-619 In reply to Matt.

Hi Matt. When you consider that the article was likely written back in 2020, when the CSS Scroll Snap Module was in its infancy, its easy to understand why scroll-top-margin wasn’t used for the original demo. Now, two years on, it’s certainly more usable.

As a global style, you could do something like this:

:root {
scroll-behavior: smooth;
}

h1:target, h2:target, h3:target, h4:target, h5:target, h6:target, p:target {
scroll-margin-top: 1rem;
background: lightyellow;
}

Or, to be sassy (if pre-processing is your thing):

h1, h2, h3, h4, h5, h6, p {
&:target {
scroll-margin-top: 1rem;
}
}

No classes were harmed during this demo. Cheers.

]]>
By: Dustin https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-618 Thu, 11 Aug 2022 05:19:36 +0000 https://spigot-16.local/?p=19374#comment-618 In reply to Matt.

scroll-margin-top worked great for me and I do prefer that over using pseudo elements. I was able to assign it to all ‘a’ tags without a problem.

Also just learned of the scroll-behavior property thanks to this page. Now I can get rid of that block of javascript I was using.

]]>
By: dev_bryan https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-617 Tue, 29 Mar 2022 16:47:12 +0000 https://spigot-16.local/?p=19374#comment-617 In reply to Matt.

Hey Matt, I hadn’t heard of that property before, I’ll certainly give it a test. Thanks for bringing it up. Guess I better check my @css-tricks feed to since I seem to be falling behind ¯\_(ツ)_/¯

]]>
By: Matt https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-616 Fri, 25 Mar 2022 17:39:19 +0000 https://spigot-16.local/?p=19374#comment-616 I am wondering why you wouldn’t just use scroll-margin-top: 100px; on the element you are scrolling to here. No need to pseudo elements or anything. I guess you can’t do a global style but if you assigned to a class you could.

]]>
By: dev_bryan https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-615 Mon, 14 Feb 2022 18:18:33 +0000 https://spigot-16.local/?p=19374#comment-615 In reply to Rebecca.

Hi Rebecca,

I’m not seeing the target:before style set in your stylesheet. Are you sure you’ve set it correctly?

]]>
By: Rebecca https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-614 Tue, 25 Jan 2022 12:05:42 +0000 https://spigot-16.local/?p=19374#comment-614 Hi, thanks for sharing this but I can’t get it to work – I’m using a free WordPress theme (Hestia) and adding this to the Custom CSS box. The scroll is smooth but the section it goes to is still hidden behind the menu bar.
Can anyone help please?
Thanks

]]>
By: Bryan Hoffman https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-613 Fri, 05 Nov 2021 16:15:49 +0000 https://spigot-16.local/?p=19374#comment-613 In reply to Lee James.

Okay that makes sense. The solution I originally used is general and not specific to any one container. Cheers!

]]>
By: Lee James https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-612 Fri, 05 Nov 2021 02:28:34 +0000 https://spigot-16.local/?p=19374#comment-612 In reply to Bryan Hoffman.

Without seeing the code in page context it’s difficult to diagnose.

That said, the issue I drew attention to – that my modification corrects – is prevalent when :target is a container such as

<section>, for example. It looks like I omitted that information from my original comment (oops). When applied directly to an inline heading :target, it’s not surprising that is should manifest much like the image you linked to demonstrates.

The modification was quickly tested in Firefox (with default browser styles and an inherited display:block applied to the :target [section] element). It was untested in other browsers.

The whole scenario is really an edge-case, as most times people will just want to set a heading as the link :target, and would arguably never see any undesirable artifacts. It’s also possible that the behavior differs dependent on base or reset stylesheet(s) applied to your testing environment.

What I observed is probably hard to anticipate due to :target being an object with a pseudo-element [:target::before] that doesn’t actually exist prior to activating the link.

Sometimes I think Schrödinger Cat is easier to wrap your head around, than CSS!

]]>
By: Bryan Hoffman https://spigot17.spigotdev.com/2020/04/08/smooth-scroll-offset-anchor-links-with-css/#comment-611 Wed, 03 Nov 2021 22:15:39 +0000 https://spigot-16.local/?p=19374#comment-611 In reply to Lee James.

Hi Lee,

I tried your method on a local version of this site, and it didn’t quite work as expected. It looks fine on page load, but when you activate the anchor, it takes on the negative margin. Here’s s a screenshot: https://share.getcloudapp.com/qGuR5j4O

I used your exact css:

:root {
scroll-behavior: smooth;
}

:target {
margin: -100px 0 0;
}

:target:before {
content: “”;
display: block;
height: 100px;
}
]]>