Removes title, meta and top margin when no title is passed to posts or pages. #20.

This commit is contained in:
mateuswetah 2019-10-07 10:54:56 -03:00
parent a9ef9227d0
commit cd9d388334
2 changed files with 41 additions and 33 deletions

View File

@ -1,18 +1,24 @@
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post(); ?>
<div class="tainacan-title">
<div class="border-bottom border-jelly-bean tainacan-title-page" style="border-width: 2px !important;">
<ul class="list-inline mb-1">
<li class="list-inline-item text-midnight-blue font-weight-bold title-page">
<?php the_title(); ?>
</li>
<li class="list-inline-item float-right title-back"><a href="javascript:history.go(-1)"><?php _e( 'Back', 'tainacan-interface' ); ?></a></li>
</ul>
<?php if ( the_title() != '') : ?>
<div class="tainacan-title">
<div class="border-bottom border-jelly-bean tainacan-title-page" style="border-width: 2px !important;">
<ul class="list-inline mb-1">
<li class="list-inline-item text-midnight-blue font-weight-bold title-page">
<?php the_title(); ?>
</li>
<li class="list-inline-item float-right title-back"><a href="javascript:history.go(-1)"><?php _e( 'Back', 'tainacan-interface' ); ?></a></li>
</ul>
</div>
</div>
</div>
<div class="mt-3 tainacan-single-post">
<?php get_template_part( 'template-parts/single-post' ); ?>
</div>
<div class="mt-3 tainacan-single-post">
<?php get_template_part( 'template-parts/single-post' ); ?>
</div>
<?php else: ?>
<div class="mt-0 tainacan-single-post">
<?php get_template_part( 'template-parts/single-post' ); ?>
</div>
<?php endif; ?>
<?php if ( ! is_singular( 'page' ) ) : ?>
<div class="row justify-content-between">
<span class="nav-previous"><?php previous_post_link( '%link', __( '<span class="meta-nav">&larr;</span> Previous', 'tainacan-interface' ) ); ?></span>

View File

@ -1,26 +1,28 @@
<article role="article" id="post_<?php the_ID()?>" <?php post_class()?>>
<header class="mb-4">
<div class="header-meta text-muted mb-5 d-flex">
<?php if ( ! is_singular( 'page' ) ) { ?>
<?php tainacan_meta_date_author(); ?>
<?php } ?>
<div class="btn-group ml-auto" role="group">
<?php if ( true == get_theme_mod( 'tainacan_facebook_share', true ) ) : ?>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="" target="_blank">
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/facebook-circle.png'; ?>" alt="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
</a>
<?php endif; ?>
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
<?php $twitter_option = get_theme_mod( 'tainacan_twitter_user' ); ?>
<?php $via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr( get_theme_mod( 'tainacan_twitter_user' ) ) : ''; ?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="">
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/twitter-circle.png'; ?>" alt="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
</a>
<?php endif; ?>
<?php if ( the_title() != '') : ?>
<header class="mb-4">
<div class="header-meta text-muted mb-5 d-flex">
<?php if ( ! is_singular( 'page' ) ) { ?>
<?php tainacan_meta_date_author(); ?>
<?php } ?>
<div class="btn-group ml-auto" role="group">
<?php if ( true == get_theme_mod( 'tainacan_facebook_share', true ) ) : ?>
<a href="http://www.facebook.com/sharer.php?u=<?php the_permalink(); ?>" class="" target="_blank">
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/facebook-circle.png'; ?>" alt="<?php esc_attr_e('Share this on facebook', 'tainacan-interface') ?>">
</a>
<?php endif; ?>
<?php if ( true == get_theme_mod( 'tainacan_twitter_share', true ) ) : ?>
<?php $twitter_option = get_theme_mod( 'tainacan_twitter_user' ); ?>
<?php $via = ! empty( $twitter_option ) ? '&amp;via=' . esc_attr( get_theme_mod( 'tainacan_twitter_user' ) ) : ''; ?>
<a href="http://twitter.com/share?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?><?php echo $via; ?>" target="_blank" class="">
<img src="<?php echo esc_url( get_template_directory_uri() ) . '/assets/images/twitter-circle.png'; ?>" alt="<?php esc_attr_e('Share this on twitter', 'tainacan-interface') ?>">
</a>
<?php endif; ?>
</div>
</div>
</div>
<?php the_post_thumbnail(); ?>
</header>
<?php the_post_thumbnail(); ?>
</header>
<?php endif; ?>
<section class="tainacan-content text-black margin-two-column">
<?php
the_content();