123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195 |
- <?php
- add_action('genesis_setup','genesischild_theme_setup', 15);
- function genesischild_theme_setup() {
- $estilos_genesis_do_pai = 'estilo-genesis-pai';
- // wp_enqueue_style($estilos_genesis_do_pai, get_template_directory_uri() . '/style.css');
- //Add support for HTML5 markup
- add_theme_support( 'html5' );
- //Add viewport metatag
- add_theme_support( 'genesis-responsive-viewport' );
- //Criou nesta aula esta lista - genesis-footer-widgets - Add 3 footer widgets
- add_theme_support( 'genesis-footer-widgets', 3 );
- //Add support for custom background
- add_theme_support( 'custom-background' );
- // Adicionando suporte ao custom-header
- add_theme_support( 'custom-header', array(
- 'default-image' => get_stylesheet_directory_uri() . '/images/logo-genesis.png',
- 'header-selector' => '.site-title a',
- 'header-text' => false,
- 'height' => 115,
- 'width' => 300
- ));
- add_image_size('footer', 50, 50, true);
- //* Activate the use of Dashicons
- add_action( 'wp_enqueue_scripts', 'load_dashicons_front_end' );
- function load_dashicons_front_end() {
- wp_enqueue_style( 'dashicons' );
- }
- //* Enqueue scripts for Responsive menu
- add_action( 'wp_enqueue_scripts', 'enqueue_responsive_menu_script' );
- function enqueue_responsive_menu_script() {
- wp_enqueue_script( 'my-responsive-menu', get_stylesheet_directory_uri() . '/js/responsive-menu.js', array( 'jquery' ), '1.0.0' );
- }
- // trocando o menu secundario para outro lugar
- remove_action('genesis_after_header', 'genesis_do_subnav');
- // remove_action('genesis_after_header', 'genesis_do_nav');
- add_action('genesis_after_footer', 'genesis_do_subnav');
- // add_action('genesis_header_right', 'genesis_do_nav');
- // registrar widgets
- function extra_widgets() {
- genesis_register_sidebar( array(
- 'id' => 'sobre1',
- 'name' => 'Área de sobre 1',
- 'description' => 'Area de widgets para sobre 1',
- 'before_widget' => '<div class="sobre one-third first">',
- 'after_widget' => '</div>'
- ) );
- genesis_register_sidebar( array(
- 'id' => 'sobre2',
- 'name' => 'Área de sobre 2',
- 'description' => 'Area de widgets para sobre 2',
- 'before_widget' => '<div class="sobre one-third">',
- 'after_widget' => '</div>'
- ) );
- genesis_register_sidebar( array(
- 'id' => 'sobre3',
- 'name' => 'Área de sobre 3',
- 'description' => 'Area de widgets para sobre 3',
- 'before_widget' => '<div class="sobre one-third">',
- 'after_widget' => '</div><div class="clearfix"></div>'
- ) );
- genesis_register_sidebar( array(
- 'id' => 'copyright',
- 'name' => 'Área de Copyright',
- 'description' => 'Area de Copyright',
- 'before_widget' => '<div class="copyright wrap">',
- 'after_widget' => '</div></div>'
- ) );
- genesis_register_sidebar( array(
- 'id' => 'pesquisa',
- 'name' => 'Área de pesquisa',
- 'description' => 'Area de pesquisa',
- 'before_widget' => '<div class="pesquisa one-fourth">',
- 'after_widget' => '</div></div>'
- ) );
- }
- add_action('widgets_init', 'extra_widgets');
- }
- function meufilho_scripts() {
- // chamando o template css depois do style.css do pai, pois como é em cascata vai sobrepor regras do pai
- // wp_enqueue_style('template', get_stylesheet_directory_uri() . '/css/template.css', array('estilo-genesis-pai'), null, 'all');
- // desliguei e copie o style.css do curso, pois a versao do genesis2.5.2 estava usando e dando erro, no curso usa a 2.5.0
- // no curso o jeito que ele importa o css e copiando o conteudo do style.css do pai e colando o no filho.
- wp_enqueue_style('template', get_stylesheet_directory_uri() . '/css/template.css', array(), null, 'all');
- // flexslider
- wp_enqueue_style('flexslider', get_stylesheet_directory_uri() . '/flexslider/flexslider.css', array(), null, 'all');
- wp_enqueue_script('flexslider-js', get_stylesheet_directory_uri() . '/flexslider/flexslider.js', array('jquery'), null, false);
- wp_enqueue_script('flexslider-jsmin', get_stylesheet_directory_uri() . '/flexslider/jquery.flexslider-min.js', array('jquery'), null, false);
- wp_enqueue_style('font-awesome', 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.6.3/css/font-awesome.min.css', array(), null, 'all');
- }
- add_action('wp_enqueue_scripts', 'meufilho_scripts');
- add_filter('genesis_footer_creds_text', 'meufilho_copyright_filtro');
- function meufilho_copyright_filtro(){
- ob_start();
- dynamic_sidebar('copyright');
- $sidebar = ob_get_contents();
- ob_end_clean();
- return $sidebar;
- }
- function add_search_box () {
- genesis_widget_area('pesquisa', array(
- 'before' => '<div class="caixa-pesquisa"><div class="wrap">',
- 'after' => '</div></div>'
- ));
- }
- add_action('genesis_before_header', 'add_search_box');
- // adicionando o slider no mesmo hook do menu, assim a prioridade ter que ser maior que a do menu pra ficar depois do menu
- add_action('genesis_after_header', 'meuslider', 15);
- function meuslider(){
- if(is_front_page()):
- ?>
- <section class="slide">
- <div class="flexslider">
- <ul class="slides">
- <?php
- $query = new WP_Query( 'posts_per_page=4&ignore_sticky_posts=true' );
- if( $query->have_posts() ) : while( $query->have_posts() ) : $query->the_post();
- ?>
- <li>
- <div class="slider-container">
- <?php
- // If we have a thumbnail, show it
- // If not, we show a placeholder image
- if( has_post_thumbnail() ):
- ?>
-
- <figure>
- <?php the_post_thumbnail('large'); ?> <!-- Tem que incluir isso aqui! -->
- </figure>
- <?php else: ?>
- <img class="img-responsive" src="https://unsplash.it/1920/650/?random" title="<?php echo esc_attr_x( 'Placeholder Image', 'title', 'parea' ); ?>">
- <?php endif; ?>
- <div class="wrap">
- <div class="slider-details-container">
- <div class="slider-title">
- <h3><a href="<?php the_permalink(); ?>" class="slider-title"><?php the_title();?></a></h3>
- </div>
- <div class="slider-description">
- <?php the_excerpt(); ?>
- </div>
- <div class="slider-readmore-button">
- <a href="<?php the_permalink(); ?>" class="btn"><?php echo _e( 'Read More!', 'parea' ) ?></a>
- </div>
- </div>
- </div>
- </div>
- </li>
- <?php
- endwhile;
- wp_reset_postdata();
- endif;
- ?>
- </ul>
- </div>
- </section>
- <?php
- endif;
- }
|