Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('ABSPATH'))
- exit;
- function anetema_styles() {
- wp_enqueue_script('site_funcoes', get_template_directory_uri() . '/js/funcoes.js', array('jquery'), null, true);
- wp_enqueue_style('style', get_template_directory_uri() . '/style.css', false, null);
- }
- add_action('wp_enqueue_scripts', 'anetema_styles', 100);
- if (function_exists('add_theme_support')) {
- add_theme_support('post-thumbnails');
- set_post_thumbnail_size(195, 183, true);
- }
- add_action( 'init', 'register_my_menus' );
- function register_my_menus() {
- register_nav_menus(
- array(
- 'topo' => 'Topo'
- )
- );
- }
- if (!function_exists('anetema_post')) {
- function anetema_post($load = false) {
- global $post;
- $thumb = get_the_post_thumbnail_url($post->ID, 'post-thumbnail');
- if (empty($thumb))
- $thumb = 'https://placehold.it/244x137';
- $arrCategorias = wp_get_post_categories($post->ID);
- $categoriaNome = '';
- $categoriaUrl = '';
- if (isset($arrCategorias[0])) {
- $categoriaNome = get_cat_name($arrCategorias[0]);
- $categoriaUrl = get_category_link($arrCategorias[0]);
- } ?>
- <li>
- <a href="<?php echo get_permalink($post->ID); ?>" title="<?php echo $post->post_title; ?>">
- <img class="lista-imagem" src="<?php echo $thumb; ?>" alt="<?php echo $post->post_title; ?>" />
- </a>
- <h3>
- <a href="<?php echo get_permalink($post->ID); ?>" title="<?php echo $post->post_title; ?>"><?php echo $post->post_title; ?></a>
- </h3>
- <div class="entry-meta">
- <a class="lista-autor" href="<?php echo site_url('?author=1'); ?>"><?php echo get_the_author_meta('display_name', $post->post_author); ?></a> - <span class="lista-data"><?php echo get_the_date('j \d\e F \d\e Y'); ?></span>
- </div>
- <div class="lista-texto"><?php echo short_desc($post->post_content); ?></div>
- </li>
- <?php
- }
- }
- if (!function_exists('anetema_pagination')) {
- function anetema_pagination() {
- if (is_singular())
- return;
- global $wp_query;
- if( $wp_query->max_num_pages <= 1 )
- return;
- $paged = get_query_var( 'paged' ) ? absint( get_query_var( 'paged' ) ) : 1;
- $max = intval( $wp_query->max_num_pages );
- if ( $paged >= 1 )
- $links[] = $paged;
- if ( $paged >= 3 ) {
- $links[] = $paged - 1;
- $links[] = $paged - 2;
- }
- if ( ( $paged + 2 ) <= $max ) {
- $links[] = $paged + 2;
- $links[] = $paged + 1;
- }
- echo '<ul class="paginacao">' . "\n";
- if ( get_previous_posts_link() )
- printf( '<li>%s</li>' . "\n", get_previous_posts_link('«') );
- if ( ! in_array( 1, $links ) ) {
- $class = 1 == $paged ? ' class="current"' : '';
- printf( '<li><a %s rel="nofollow" href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( 1 ) ), '1' );
- if ( ! in_array( 2, $links ) )
- echo '<li>…</li>';
- }
- sort( $links );
- foreach ((array) $links as $link) {
- $class = $paged == $link ? ' class="current"' : '';
- printf( '<li><a %s rel="nofollow" href="%s">%s</a></li>' . "\n", $class, esc_url( get_pagenum_link( $link ) ), $link );
- }
- if (get_next_posts_link())
- printf( '<li>%s</li>' . "\n", get_next_posts_link('Mais') );
- echo '</ul>' . "\n";
- }
- }
- function anetema_register_sidebars() {
- register_sidebar(
- array(
- 'id' => 'lateral',
- 'name' => 'Lateral',
- 'before_widget' => '<section id="%1$s" class="widget %2$s"><div class="widget-container">',
- 'after_widget' => '</div></section>',
- 'before_title' => '<div class="widget-title"><h4>',
- 'after_title' => '</h4></div>'
- )
- );
- }
- add_action('widgets_init', 'anetema_register_sidebars');
- function anetema_comment($comment, $args, $depth) {
- $GLOBALS['comment'] = $comment; ?>
- <!--inicio lista-->
- <li <?php comment_class(); ?> id="li-comment-<?php comment_ID() ?>">
- <!--inicio comentario campo-->
- <div id="comment-<?php comment_ID(); ?>" class="comentario-campo">
- <!-- avatar comentario -->
- <div class="avatar-comentario">
- <?php echo get_avatar( $comment, 74 ); ?>
- </div>
- <!-- fim avatar comentario -->
- <!--inicio comentario e nome-->
- <div class="comentario-nome">
- <!--inicio nome comentarista-->
- <div class="nome-comentarista">
- <?php printf(__('%s'), get_comment_author_link())?> •
- <span class="data-comentario"> <?php echo get_comment_date('j \d\e F \d\e Y'); ?> </span>
- </div>
- <!--fim nome comentarista-->
- <div class="clear"></div>
- <!--inicio texto comentario-->
- <div class="texto-comentario">
- <?php comment_text() ?>
- <div class="clear"></div>
- <div class="reply-link">
- <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
- </div>
- </div>
- <!--fim texto comentario-->
- </div>
- <!--fim comentario e nome-->
- </div>
- </li>
- <?php
- }
- if (!function_exists('short_desc')) {
- function short_desc($text = '', $tam = 108) {
- $text = strip_shortcodes($text);
- $text = preg_replace('/<[^<]+?>/i', ' ', $text);
- if (strlen($text) > $tam) {
- $text = preg_replace("/^(.{1,$tam})(\s.*|$)/s", '\\1...', $text);
- }
- return $text;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement