Switch homepage review stat from Facebook to Google
- Replace inc/facebook-stats.php with inc/google-reviews.php: fetches
average star rating + review count from the Places API (New) instead
of Facebook's Graph API, same cache-to-JSON/fallback-on-failure shape
as before.
- index.php: stat card now shows the native star rating ("4.8★ average
rating") instead of a recommend %, sourced from Google. Drops the
Facebook-followers line entirely — Google's API has no equivalent and
showing a stale/static number wasn't worth keeping. "Follow on
Facebook" links elsewhere on the site are untouched.
- config.example.php: swap FB_PAGE_ID/FB_PAGE_ACCESS_TOKEN/
FB_STATS_CACHE_TTL/FB_FALLBACK_* for GOOGLE_PLACE_ID/
GOOGLE_PLACES_API_KEY/GOOGLE_STATS_CACHE_TTL/GOOGLE_FALLBACK_RATING/
GOOGLE_FALLBACK_REVIEW_COUNT (set to the pub's actual 4.8★/71 reviews),
with setup instructions in comments. config.php (gitignored) updated
to match.
- Remove the now-dead .stat-row CSS that only existed for the dropped
followers line; rebuild styles.css.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2145094e55
commit
5bed636cca
6 files changed
+117
-150
No files matched your search
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
require __DIR__ . '/config.php';
|
||||
require __DIR__ . '/inc/facebook-stats.php';
|
||||
require __DIR__ . '/inc/google-reviews.php';
|
||||
require __DIR__ . '/inc/announcements.php';
|
||||
require __DIR__ . '/inc/hours.php';
|
||||
$fbStats = fritz_facebook_stats();
|
||||
$googleReviews = fritz_google_reviews();
|
||||
$activeAnnouncements = get_active_announcements();
|
||||
$hoursByDay = get_all_hours();
|
||||
$siteUrl = rtrim(SITE_URL, '/');
|
||||
@@ -125,14 +125,9 @@ $siteUrl = rtrim(SITE_URL, '/');
|
||||
</div>
|
||||
<div class="stat-card reveal">
|
||||
<span class="eyebrow">As the Regulars See It</span>
|
||||
<div class="stat-big"><?= (int) $fbStats['recommend_pct'] ?>%</div>
|
||||
<p class="stat-label">recommend The Old Fitz</p>
|
||||
<p class="stat-source">Source: Facebook reviews (<?= (int) $fbStats['review_count'] ?>)</p>
|
||||
<div class="stat-row">
|
||||
<div class="stat-big"><?= number_format((int) $fbStats['followers']) ?>+</div>
|
||||
<p class="stat-label">people following along on Facebook</p>
|
||||
<p class="stat-source">Source: Facebook followers</p>
|
||||
</div>
|
||||
<div class="stat-big"><?= number_format((float) $googleReviews['rating'], 1) ?>★</div>
|
||||
<p class="stat-label">average rating</p>
|
||||
<p class="stat-source">Source: Google reviews (<?= (int) $googleReviews['review_count'] ?>)</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user