support for widgets

This commit is contained in:
cupcakearmy 2019-06-02 12:05:20 +02:00
parent cf0ecb26a0
commit efa3a25d9c
3 changed files with 71 additions and 21 deletions

View File

@ -14,6 +14,19 @@ add_action( 'wp_enqueue_scripts', function () {
wp_enqueue_style( 'fonts', get_template_directory_uri() . '/vendor/fonts/import.css' );
} );
add_action( 'widgets_init', function () {
register_sidebar( array(
'name' => 'Below posts',
'id' => 'below_posts',
'before_widget' => '<div class="widget">',
'after_widget' => '</div>',
'before_title' => '<h3 class="alt-font">',
'after_title' => '</h3>',
) );
} );
add_action( 'admin_init', function () {
add_settings_section( 'section-link', 'Links', null, 'theme-options' );

View File

@ -22,36 +22,64 @@ $dates = getDates();
<div class="alt-font">previous</div>
</a>
<div class="flex item grow" id="main">
<div class="flex item grow container vertical middle" id="main">
<!-- Title -->
<div class="flex container vertical middle">
<div class="box" id="header">
<h1 class="alt-font"><?= the_title() ?></h1>
</div>
</div>
<div class="flex container vertical middle" id="content">
<div class="flex container horizontal">
<div>
<b><?= $dates['created'] ?></b>
<?php if ( $dates['different'] ) { ?>
<br/>
<small>updated on <?= $dates['modified'] ?></small>
<?php } ?>
</div>
<div class="flex item grow"></div>
<div class="text-align-right">
<b>~<?= do_shortcode( '[rt_reading_time]' ); ?> min</b>
<?= getCurrentPageViews() ?>
</div>
</div>
<br><br>
<?php the_content(); ?>
<!-- Content Body -->
<div class="flex container vertical middle" id="content">
<!-- Reading time and date -->
<?php if ( is_singular( 'post' ) ) : ?>
<div class="flex container horizontal">
<div>
<b><?= $dates['created'] ?></b>
<?php if ( $dates['different'] ) { ?>
<br/>
<small>updated on <?= $dates['modified'] ?></small>
<?php } ?>
</div>
<div class="flex item grow"></div>
<div class="text-align-right">
<b>~<?= do_shortcode( '[rt_reading_time]' ); ?> min</b>
<?= getCurrentPageViews() ?>
</div>
</div>
<br><br>
<?php endif; ?>
<!-- Content -->
<?php the_content(); ?>
</div>
<div class="flex container vertical middle">
<br>
<?php render_current_tags(); ?>
<!-- Tags -->
<?php if ( is_singular( 'post' ) ) : ?>
<div class="auto-width text-align-center">
<br>
<?php render_current_tags(); ?>
<br>
</div>
<?php endif; ?>
<!-- Links -->
<div class="flex container vertical middle auto-width">
<?php render_links( true ); ?>
</div>
<!-- Bottom Widgets -->
<?php if ( is_singular( 'post' ) ) : ?>
<?php if ( is_active_sidebar( 'below_posts' ) ) : ?>
<br><br><br><br><br><br>
<div class="auto-width widget-area text-align-center">
<?php dynamic_sidebar( 'below_posts' ); ?>
</div>
<?php endif; ?>
<?php endif; ?>
</div>
<a class="flex item shrink links" href="<?= getNextURL( true ) ?>">

View File

@ -69,6 +69,10 @@ hr {
text-align: left;
}
.text-align-center {
text-align: center;
}
#app {
width: 100vw;
height: 100vh;
@ -108,3 +112,8 @@ img.icon {
display: inline-block;
vertical-align: middle;
}
.auto-width {
max-width: var(--text-width);
width: 100%;
}