Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Apply fallback content to frontpage. #38

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions assets/scss/elements/_card.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
@include media(config('media', 'breakpoints', 'default')) {
.card {
border: 1px solid #dae1e7;
border-radius: .25rem;
padding: 15px;

.info {
color: #8795a1;
margin-bottom: 0;
text-transform: uppercase;
letter-spacing: .1em;
font-weight: lighter;
}

h1, h2, h3, h4, h5, h6, p {
margin-top: 0;
}
}
}
2 changes: 1 addition & 1 deletion assets/scss/front.scss
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@import "bootstrap", "elements/single", "elements/single/event", "elements/front/header", "elements/link-back";
@import "bootstrap", "elements/single", "elements/single/event", "elements/front/header", "elements/link-back", "elements/card";
3 changes: 3 additions & 0 deletions content/home.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
There are currently no upcoming meetups.

If you'd like to apply for a talk or contribute in any other way, please [reach out to us](/about/#contact-information) or start a [discussion on GitHub](https://github.com/wp-berlin/planung/issues/new).
8 changes: 6 additions & 2 deletions web/assets/themes/wp-berlin/front-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,12 @@
the_post();
?>
<div class="frontpage-main">
<?php the_content(); ?>
<?php do_action('wpberlin/website/front_page'); ?>
<?php

apply_filters('wpberlin/website/front_page_no_events', get_the_title(), get_the_content());
do_action('wpberlin/website/front_page_events');

?>
</div>
<?php
endwhile;
Expand Down
21 changes: 20 additions & 1 deletion web/plugins/meetup-api/meetup-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,30 @@
);
$provider = new CachedProvider($provider);

// Display `the_content` only if there are no valid events.
add_filter('wpberlin/website/front_page_no_events', function ($title, $content) use ($provider) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this filter (as well as the one below), should be put into the theme instead of the plugin. Instead of coupling the theme to the plugin, we should add the plugin as a dependency to the theme (cf. #41)

echo '';
if (empty($provider->getValidEvents())) {
?>
<div class="single-event">
<h1 class="single-event-title"><?= $title; ?></h1>
<div class="single-main">
<?= apply_filters('the_content', $content); ?>
</div>
<div class="single-sidebar card">
<h4>Meeting Minutes</h4>
<p>Missed a meetup? Check out our notes, links and code snippets from previous meetups in our <a href="/meeting-minutes">meeting minutes</a>.</p>
</div>
</div>
<?php
}
}, 10, 2);

foreach ($provider->getValidEvents() as $event) {
if (empty($event)) {
continue;
}
add_action('wpberlin/website/front_page', function () use ($event) {
add_action('wpberlin/website/front_page_events', function () use ($event) {
$dateObj = DateTime::createFromFormat('U', substr($event['time'], 0, -3));
$dateObj->setTimeZone(new DateTimeZone('Europe/Berlin'));
$int = new DateInterval(sprintf('PT%dS', substr($event['duration'], 0, -3)));
Expand Down