123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147 |
- <?php
- function popper_child_setup(){
- // preparar o tema para a traducao
- load_child_theme_textdomain( 'popper-child', get_stylesheet_directory() . '/languages' );
-
- // registrar outro menu no rodape
- register_nav_menus( array(
- 'rodape' => esc_html__( 'Menu do Rodape', 'popper-child' ),
- ) );
- /**
- * Register 2 widget area.
- *
- * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
- */
- function popper_child_widgets_init_footer() {
- register_sidebar( array(
- 'name' => esc_html__( 'Widget Area no Footer', 'popper-child' ),
- 'id' => 'sidebar-foooter',
- 'description' => '',
- 'before_widget' => '<aside id="%1$s" class="widget %2$s">',
- 'after_widget' => '</aside>',
- 'before_title' => '<h2 class="widget-title">',
- 'after_title' => '</h2>',
- ) );
- }
- add_action( 'widgets_init', 'popper_child_widgets_init_footer' );
- }
- add_action('after_setup_theme', 'popper_child_setup');
- /**
- * Enqueue scripts and styles.
- */
- function popper_child_scripts() {
- // Fonts: Fira Sans and Merriweather, https://www.google.com/fonts
- wp_enqueue_style( 'popper-child-google-fonts', '//fonts.googleapis.com/css?family=Alegreya+Sans+SC:400,400i,500,500i,800,800i|Anonymous+Pro:400,400i,700,700i' );
- // des-enfilirar styles do tema pai
- wp_dequeue_style('popper-google-fonts');
- }
- add_action( 'wp_enqueue_scripts', 'popper_child_scripts', 11);
- // 11 para ser executado depois do popper_script do pai. o padrao é 10
- // https://developer.wordpress.org/reference/functions/add_action/
- function popper_posted_on() {
- $author_id = get_the_author_meta( 'ID' );
- $time_string = '<time class="entry-date published updated" 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">%4$s</time>';
- }
- $time_string = sprintf( $time_string,
- esc_attr( get_the_date( 'c' ) ),
- esc_html( get_the_date() ),
- esc_attr( get_the_modified_date( 'c' ) ),
- esc_html( get_the_modified_date() )
- );
- $posted_on = sprintf(
- esc_html_x( ' on %s', 'post date', 'popper-child' ),
- '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
- );
- $byline = sprintf(
- esc_html_x( 'by %s', 'post author', 'popper-child' ),
- '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
- );
- // Display author avatar if author has a Gravatar
- if ( validate_gravatar( $author_id ) ) {
- echo '<div class="meta-content has-avatar">';
- echo '<div class="author-avatar">' . get_avatar( $author_id ) . '</div>';
- } else {
- echo '<div class="meta-content">';
- }
- echo '<span class="byline">' . $byline . ' </span><span class="posted-on">' . $posted_on . ' </span>'; // WPCS: XSS OK.
-
-
- $categories_list = get_the_category_list( esc_html__( ', ', 'popper-child' ) );
- if ( $categories_list && popper_categorized_blog() ) {
- printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'popper-child' ) . '</span>', $categories_list ); // WPCS: XSS OK.
- }
- if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
- echo '<span class="comments-link">';
- comments_popup_link( esc_html__( 'Leave a comment', 'popper-child' ), esc_html__( '1 Comment', 'popper-child' ), esc_html__( '% Comments', 'popper-child' ) );
- echo '</span>';
- }
- echo '</div><!-- .meta-content -->';
- }
- function popper_index_posted_on() {
- $author_id = get_the_author_meta( 'ID' );
- $time_string = '<time class="entry-date published updated" 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">%4$s</time>';
- }
- $time_string = sprintf( $time_string,
- esc_attr( get_the_date( 'c' ) ),
- esc_html( get_the_date() ),
- esc_attr( get_the_modified_date( 'c' ) ),
- esc_html( get_the_modified_date() )
- );
- $posted_on = sprintf(
- esc_html_x( 'Published %s', 'post date', 'popper' ),
- '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>'
- );
- $byline = sprintf(
- esc_html_x( 'by %s', 'post author', 'popper' ),
- '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>'
- );
- echo '<div class="meta-content">';
- echo '<span class="byline">' . $byline . ' </span><span class="posted-on">' . $posted_on . ' </span>'; // WPCS: XSS OK.
-
- $categories_list = get_the_category_list( esc_html__( ', ', 'popper-child' ) );
- if ( $categories_list && popper_categorized_blog() ) {
- printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'popper-child' ) . '</span>', $categories_list ); // WPCS: XSS OK.
- }
- if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) {
- echo '<span class="comments-link">';
- comments_popup_link( esc_html__( 'Leave a comment', 'popper' ), esc_html__( '1 Comment', 'popper' ), esc_html__( '% Comments', 'popper' ) );
- echo '</span>';
- }
- echo '</div><!-- .meta-content -->';
- }
- ?>
|