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' ); 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_action( 'admin_init', function () {
add_settings_section( 'section-link', 'Links', null, 'theme-options' ); add_settings_section( 'section-link', 'Links', null, 'theme-options' );

View File

@ -22,36 +22,64 @@ $dates = getDates();
<div class="alt-font">previous</div> <div class="alt-font">previous</div>
</a> </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="flex container vertical middle">
<div class="box" id="header"> <div class="box" id="header">
<h1 class="alt-font"><?= the_title() ?></h1> <h1 class="alt-font"><?= the_title() ?></h1>
</div> </div>
</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>
<div class="flex container vertical middle">
<br> <!-- Tags -->
<?php render_current_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 ); ?> <?php render_links( true ); ?>
</div> </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> </div>
<a class="flex item shrink links" href="<?= getNextURL( true ) ?>"> <a class="flex item shrink links" href="<?= getNextURL( true ) ?>">

View File

@ -69,6 +69,10 @@ hr {
text-align: left; text-align: left;
} }
.text-align-center {
text-align: center;
}
#app { #app {
width: 100vw; width: 100vw;
height: 100vh; height: 100vh;
@ -107,4 +111,9 @@ img.icon {
height: 1em; height: 1em;
display: inline-block; display: inline-block;
vertical-align: middle; vertical-align: middle;
}
.auto-width {
max-width: var(--text-width);
width: 100%;
} }