Merge branch 'feature/wp-estructure' into develop
This commit is contained in:
commit
84f8038249
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
$userInfo = get_userdata( get_query_var('author'));
|
||||
$isAuthor = true;
|
||||
if (
|
||||
!in_array('contributor', $userInfo -> roles) &&
|
||||
!in_array('administrator', $userInfo -> roles) &&
|
||||
!in_array('author', $userInfo -> roles) &&
|
||||
!in_array('editor', $userInfo -> roles)
|
||||
) {
|
||||
$isAuthor = false;
|
||||
wp_redirect(esc_url( home_url() ) . '/404', 404);
|
||||
}
|
||||
?>
|
||||
<?php get_header(); ?>
|
||||
|
||||
<div class="container-fluid mt-5">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<header class="mb-4 border-bottom">
|
||||
<?php if ($isAuthor === true): ?>
|
||||
<h1>
|
||||
<?php _e('Posts by: ', 'tainacan'); echo get_the_author_meta( 'display_name' ); ?>
|
||||
</h1>
|
||||
<?php endif; ?>
|
||||
</header>
|
||||
<?php if(have_posts()): ?>
|
||||
<?php get_template_part('template-parts/index-loop'); ?>
|
||||
<?php else: ?>
|
||||
<?php get_template_part('template-parts/index-none'); ?>
|
||||
<?php endif; ?>
|
||||
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -0,0 +1,22 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div class="container-fluid mt-5">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<header class="mb-4 border-bottom">
|
||||
<h1>
|
||||
<?php _e('Category: ', 'tainacan'); echo single_cat_title(); ?>
|
||||
</h1>
|
||||
</header>
|
||||
<?php get_template_part('template-parts/index-loop'); ?>
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -1,56 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
if(!function_exists('tainacan_setup')) {
|
||||
|
||||
/**
|
||||
* Execulta após o tema ser inicializado.
|
||||
* Isso é usado para a configuração básica do tema, registro dos recursos do tema e init hooks.
|
||||
* Observe que esta função está conectada ao gancho after_setup_theme, que é executado antes do gancho de init.
|
||||
*/
|
||||
function tainacan_setup() {
|
||||
/**
|
||||
* Não exibe o menu do administrador na pagina do site. Mesmo quando estiver logado!
|
||||
**/
|
||||
show_admin_bar( false );
|
||||
|
||||
/**
|
||||
* Desabilita o FTP na instalação de Plugins
|
||||
*/
|
||||
define('FS_METHOD', 'direct');
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'tainacan_setup' );
|
||||
|
||||
/**
|
||||
* Inclui os scripts javascript necessários ao front do thema
|
||||
*/
|
||||
function tainacanEnqueueScripts(){
|
||||
//Adicionado o jquery ao footer das páginas.
|
||||
wp_deregister_script( 'jquery' );
|
||||
wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
|
||||
wp_enqueue_script( 'jquery' );
|
||||
|
||||
//Dependencia do bootstrap 4
|
||||
wp_enqueue_script('popper', get_template_directory_uri() . '/assets/vendor/bootstrap/js/popper.min.js', '', '', true);
|
||||
//JS Bootstrap 4
|
||||
wp_enqueue_script('bootstrap', get_template_directory_uri() . '/assets/vendor/bootstrap/js/bootstrap.min.js', array('jquery'), '4.0.0', true);
|
||||
wp_enqueue_script( 'charts', 'https://www.gstatic.com/charts/loader.js');
|
||||
|
||||
//Javascript for Tainacan
|
||||
wp_enqueue_script('jsTainacan', get_template_directory_uri() . '/assets/js/js.js', '', '1.0', true);
|
||||
wp_enqueue_script('collectionGraph', get_template_directory_uri() . '/assets/js/charts.js', array('charts'), '1.0');
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'tainacanEnqueueScripts');
|
||||
|
||||
/**
|
||||
* Inclui os styles necessários ao front do thema
|
||||
*/
|
||||
function tainacanEnqueueStyles(){
|
||||
//Style Bootstrap 4
|
||||
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/vendor/bootstrap/css/bootstrap.min.css');
|
||||
//Style Tainacan
|
||||
wp_enqueue_style('style', get_stylesheet_uri(), array('bootstrap'));
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'tainacanEnqueueStyles');
|
||||
require get_template_directory() . '/functions/setup.php';
|
||||
require get_template_directory() . '/functions/enqueues.php';
|
||||
require get_template_directory() . '/functions/pagination.php';
|
|
@ -0,0 +1,55 @@
|
|||
<?php
|
||||
/**
|
||||
* Enqueues Theme
|
||||
*/
|
||||
|
||||
if ( ! function_exists('tainacan_Enqueues') ) {
|
||||
/**
|
||||
* Inclui os scripts javascript e os styles necessários ao front-end do thema
|
||||
*/
|
||||
function tainacan_Enqueues(){
|
||||
/**
|
||||
* Adicionando o jquery ao footer das páginas.
|
||||
*/
|
||||
wp_deregister_script( 'jquery' );
|
||||
wp_register_script( 'jquery', includes_url( '/js/jquery/jquery.js' ), false, NULL, true );
|
||||
wp_enqueue_script( 'jquery' );
|
||||
|
||||
/**
|
||||
* Bootstrap 4
|
||||
*/
|
||||
//Style
|
||||
wp_register_style('bootstrap4CSS', get_template_directory_uri() . '/assets/vendor/bootstrap/css/bootstrap.min.css', '', '4.0.0', '');
|
||||
wp_enqueue_style('bootstrap4CSS');
|
||||
//Javascript
|
||||
wp_register_script('bootstrap4JS', get_template_directory_uri() . '/assets/vendor/bootstrap/js/bootstrap.min.js', array('jquery'), '4.0.0', true);
|
||||
wp_enqueue_script('bootstrap4JS');
|
||||
//Popper
|
||||
wp_register_script('popper_bootstrap4', get_template_directory_uri() . '/assets/vendor/bootstrap/js/popper.min.js', '', '', true);
|
||||
wp_enqueue_script('popper_bootstrap4');
|
||||
|
||||
/**
|
||||
* Google Charts
|
||||
*/
|
||||
wp_register_script( 'googleCharts', 'https://www.gstatic.com/charts/loader.js');
|
||||
wp_enqueue_script('googleCharts');
|
||||
|
||||
/**
|
||||
* Tainacan Theme
|
||||
*/
|
||||
wp_register_style('tainacanStyle', get_stylesheet_uri(), array('bootstrap4CSS'));
|
||||
wp_enqueue_style('tainacanStyle');
|
||||
wp_register_script('tainacanJS', get_template_directory_uri() . '/assets/js/js.js', '', '1.0', true);
|
||||
wp_enqueue_script('tainacanJS');
|
||||
wp_register_script('collectionGraph_googleCharts', get_template_directory_uri() . '/assets/js/charts.js', array('googleCharts'), '1.0');
|
||||
wp_enqueue_script('collectionGraph_googleCharts');
|
||||
|
||||
/**
|
||||
* Comments
|
||||
*/
|
||||
if (is_singular() && comments_open() && get_option('thread_comments')) {
|
||||
wp_enqueue_script('comment-reply');
|
||||
}
|
||||
}
|
||||
}
|
||||
add_action('wp_enqueue_scripts', 'tainacan_Enqueues');
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
/**!
|
||||
* Bootstrap 4 pagination
|
||||
*/
|
||||
if ( ! function_exists( 'pagination_bst4' ) ) {
|
||||
function pagination_bst4() {
|
||||
global $wp_query;
|
||||
$big = 999999999; // This needs to be an unlikely integer
|
||||
// For more options and info view the docs for paginate_links()
|
||||
// http://codex.wordpress.org/Function_Reference/paginate_links
|
||||
$paginate_links = paginate_links( array(
|
||||
'base' => str_replace( $big, '%#%', get_pagenum_link($big) ),
|
||||
'current' => max( 1, get_query_var('paged') ),
|
||||
'total' => $wp_query->max_num_pages,
|
||||
'mid_size' => 5,
|
||||
'prev_next' => True,
|
||||
'prev_text' => __('< Newer', 'tainacan'),
|
||||
'next_text' => __('Older >', 'tainacan'),
|
||||
'type' => 'list'
|
||||
) );
|
||||
$paginate_links = str_replace( "<ul class='page-numbers'>", "<ul class='pagination'>", $paginate_links );
|
||||
$paginate_links = str_replace( "<li>", "<li class='page-item'>", $paginate_links );
|
||||
$paginate_links = str_replace( "<li class='page-item'><span aria-current='page' class='page-numbers current'>", "<li class='page-item active'><a class='page-link' href='#'>", $paginate_links );
|
||||
$paginate_links = str_replace( "<a", "<a class='page-link' ", $paginate_links );
|
||||
$paginate_links = str_replace( "</span>", "</a>", $paginate_links );
|
||||
$paginate_links = preg_replace( "/\s*page-numbers/", "", $paginate_links );
|
||||
// Display the pagination if more than one page is found
|
||||
if ( $paginate_links ) {
|
||||
echo $paginate_links;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
/**
|
||||
* Setup Theme
|
||||
*/
|
||||
|
||||
if(!function_exists('tainacan_setup')) {
|
||||
|
||||
/**
|
||||
* Execulta após o tema ser inicializado.
|
||||
* Isso é usado para a configuração básica do tema, registro dos recursos do tema e init hooks.
|
||||
* Observe que esta função está conectada ao gancho after_setup_theme, que é executado antes do gancho de init.
|
||||
*/
|
||||
function tainacan_setup() {
|
||||
/**
|
||||
* Não exibe o menu do administrador na pagina do site. Mesmo quando estiver logado!
|
||||
**/
|
||||
show_admin_bar( false );
|
||||
|
||||
/**
|
||||
* Desabilita o FTP na instalação de Plugins
|
||||
*/
|
||||
define('FS_METHOD', 'direct');
|
||||
}
|
||||
|
||||
}
|
||||
add_action( 'after_setup_theme', 'tainacan_setup' );
|
||||
|
||||
if ( ! function_exists( 'tainacan_post_date' ) ) {
|
||||
function tainacan_post_date() {
|
||||
if ( in_array( get_post_type(), array( 'post', 'attachment' ) ) ) {
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time>';
|
||||
if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) {
|
||||
$time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time> <time class="updated" datetime="%3$s">(updated %4$s)</time>';
|
||||
}
|
||||
$time_string = sprintf( $time_string,
|
||||
esc_attr( get_the_date( 'c' ) ),
|
||||
get_the_date(),
|
||||
esc_attr( get_the_modified_date( 'c' ) ),
|
||||
get_the_modified_date()
|
||||
);
|
||||
echo $time_string;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
<nav class="navbar navbar-expand-md navbar-light bg-white menu-shadow px-1">
|
||||
<div class="d-md-flex ml-md-auto mr-md-4">
|
||||
<a class="navbar-brand tainacan-logo" href="#">
|
||||
<a class="navbar-brand tainacan-logo" href="<?=bloginfo( 'url' ) ?>">
|
||||
<img src="<?php echo get_template_directory_uri().'/assets/images/logo.svg' ?>" class="logo" style="width: 150px">
|
||||
</a>
|
||||
<div class="btn-group pt-1 ml-auto">
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
<?php
|
||||
//Header
|
||||
get_header();
|
||||
<?php get_header(); ?>
|
||||
|
||||
//Footer
|
||||
get_footer();
|
||||
<div class="container-fluid">
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<?php get_template_part('template-parts/index-loop'); ?>
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php get_footer();
|
|
@ -0,0 +1,17 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div class="container-fluid mt-5">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<?php get_template_part('template-parts/page-content'); ?>
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -0,0 +1,20 @@
|
|||
<?php get_header(); ?>
|
||||
|
||||
<div class="container-fluid mt-5">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<header class="mb-4 border-bottom">
|
||||
<h1><?php _e('Search Results for', 'tainacan'); ?> “<?php the_search_query(); ?>”</h1>
|
||||
</header>
|
||||
<?php get_template_part('template-parts/search-results'); ?>
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -1,7 +1,17 @@
|
|||
<?php
|
||||
<?php get_header(); ?>
|
||||
|
||||
get_header();
|
||||
<div class="container-fluid mt-5">
|
||||
<div class="row">
|
||||
|
||||
get_template_part('template-parts/loop');
|
||||
<div class="col-sm">
|
||||
<div id="content" role="main">
|
||||
<?php get_template_part('template-parts/single-post', get_post_format()); ?>
|
||||
</div><!-- /#content -->
|
||||
</div>
|
||||
|
||||
get_footer();
|
||||
<?php get_sidebar(); ?>
|
||||
|
||||
</div><!-- /.row -->
|
||||
</div><!-- /.container-fluid -->
|
||||
|
||||
<?php get_footer(); ?>
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
<div class="<?php if(!is_single()) : echo 'card-columns'; endif; ?> mt-3">
|
||||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
||||
<div class="col-sm">
|
||||
<div class="card w-100">
|
||||
<h5 class="card-header"><?php the_title(); ?></h5>
|
||||
<div class="card-body">
|
||||
<p class="card-text"><?php if(is_single()) : the_content(); else : the_excerpt(); endif; ?></p>
|
||||
<a href="<?php the_permalink(); ?>" class="btn btn-primary">View more</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php endwhile; else: ?>
|
||||
<p><?php _e('Sorry, no posts matched your criteria.', 'tainacan'); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<nav class="mx-auto">
|
||||
<?php echo pagination_bst4(); ?>
|
||||
</nav>
|
|
@ -1,6 +0,0 @@
|
|||
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
|
||||
|
||||
|
||||
<?php endwhile; else: ?>
|
||||
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
|
||||
<?php endif; ?>
|
|
@ -0,0 +1,12 @@
|
|||
<?php if(have_posts()): while(have_posts()): the_post(); ?>
|
||||
<article role="article" id="post_<?php the_ID()?>" <?php post_class()?>>
|
||||
<header>
|
||||
<h2><a href="<?php the_permalink(); ?>"><?php the_title()?></a></h2>
|
||||
</header>
|
||||
<?php the_excerpt(); ?>
|
||||
</article>
|
||||
<?php endwhile; else: ?>
|
||||
<div class="alert alert-warning">
|
||||
<i class="material-icons">warning</i> <?php _e('Sorry, your search yielded no results.', 'tainacan'); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
|
@ -0,0 +1,53 @@
|
|||
<?php if(have_posts()): while(have_posts()): the_post(); ?>
|
||||
<article role="article" id="post_<?php the_ID()?>" <?php post_class()?>>
|
||||
<header class="mb-4">
|
||||
<h1>
|
||||
<?php the_title()?>
|
||||
</h1>
|
||||
<div class="header-meta text-muted">
|
||||
<?php
|
||||
_e('By ', 'tainacan');
|
||||
the_author_posts_link();
|
||||
_e(' on ', 'tainacan');
|
||||
tainacan_post_date();
|
||||
?>
|
||||
</div>
|
||||
</header>
|
||||
<main>
|
||||
<?php
|
||||
the_post_thumbnail();
|
||||
the_content();
|
||||
wp_link_pages();
|
||||
?>
|
||||
</main>
|
||||
<footer class="mt-5 border-top pt-3">
|
||||
<p>
|
||||
<?php _e('Category: ', 'tainacan'); the_category(', ') ?> | <?php if (has_tag()) { the_tags('Tags: ', ', '); ?> | <?php } _e('Comments', 'tainacan'); ?>: <?php comments_popup_link(__('None', 'tainacan'), '1', '%'); ?>
|
||||
</p>
|
||||
<div class="author-bio media border-top pt-3">
|
||||
<?php get_avatar(); ?>
|
||||
<div class="media-body ml-3">
|
||||
<p class="h4 author-name"><?php the_author_posts_link(); ?></p>
|
||||
<p class="author-description"><?php the_author_description(); ?></p>
|
||||
<p class="author-other-posts mb-0 border-top pt-3"><?php _e('Other posts by ', 'tainacan'); the_author_posts_link(); ?></p>
|
||||
</div>
|
||||
</div><!-- /.author-bio -->
|
||||
</footer>
|
||||
</article>
|
||||
<?php
|
||||
if ( comments_open() || get_comments_number() ) :
|
||||
comments_template();
|
||||
endif;
|
||||
endwhile; else:
|
||||
wp_redirect(esc_url( home_url() ) . '/404', 404);
|
||||
exit;
|
||||
endif;
|
||||
?>
|
||||
<div class="row mt-5 border-top pt-3">
|
||||
<div class="col">
|
||||
<?php previous_post_link('%link', '<i class="fas fa-fw fa-arrow-left"></i> Previous post: '.'%title'); ?>
|
||||
</div>
|
||||
<div class="col text-right">
|
||||
<?php next_post_link('%link', 'Next post: '.'%title' . ' <i class="fas fa-fw fa-arrow-right"></i>'); ?>
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue