Site icon Hip-Hop Website Design and Development

Archive per yr of a customized put up getting the flawed put up

Archive per yr of a customized put up getting the flawed put up

I received the wp_get_the_archives() to record the years of my put up however regardless that the url is okay, the put up proven within the yr archive simply give the final put up relying on what number of put up I’ve per yr.

For instance, I’ve 3 put up for 2008, the archive of that yr will solely present me 3 posts however simply the final three (2 from 2021 and 1 from 2016). If I’ve 1 from 2016, the archive will present me one put up, however is simply the final one from 2021. And so forth… what did I do flawed?

My features.php file


<?php 
operate recursos_ah6studio(){
    wp_enqueue_style('bootstrap', get_theme_file_uri('/css/bootstrap.min.css'));
    wp_enqueue_style('slick', get_theme_file_uri('/slick/slick.css'));
    wp_enqueue_style('slick-theme', get_theme_file_uri('/slick/slick-theme.css'));
    wp_enqueue_style('magnific-popup', get_theme_file_uri('/magnific-popup/magnific-popup.css'));
    wp_enqueue_style('font-awesome', get_theme_file_uri('/fontawesome-5.5/css/all.min.css'));
    wp_enqueue_style('estilo_ah6studio', get_stylesheet_uri());
    
    /*wp_enqueue_script('mainJS', get_theme_file_uri('/js/main_js.js'), NULL, '1.0', true); */
    wp_enqueue_script('jquery', get_theme_file_uri('/js/jquery-3.5.1.min.js'), NULL, '1.0', true);
    wp_enqueue_script('popper', get_theme_file_uri('/js/popper.min.js'), NULL, '1.0', true);
    wp_enqueue_script('boostrap', get_theme_file_uri('/js/bootstrap.min.js'), NULL, '1.0', true);
    wp_enqueue_script('slickJS', get_theme_file_uri('/slick/slick.min.js'), NULL, '1.0', true);
    wp_enqueue_script('magnific-popup', get_theme_file_uri('/magnific-popup/jquery.magnific-popup.min.js'), NULL, '1.0', true);
    wp_enqueue_script('easingJS', get_theme_file_uri('/js/easing.min.js'), NULL, '1.0', true);
    wp_enqueue_script('singlePageJS', get_theme_file_uri('/js/jquery.singlePageNav.min.js'), NULL, '1.0', true); 
    wp_enqueue_script('tool-tip', get_theme_file_uri('/js/tooltip.js'), NULL, '1.0', true);

} 
add_action('wp_enqueue_scripts', 'recursos_ah6studio');

operate mytheme_enqueue_front_page_scripts() {
    if( is_front_page() )
    {
        wp_enqueue_script('bkcground-random', get_theme_file_uri('/js/background_random.js'), NULL, '1.0', true);   
    }
}
add_action( 'wp_enqueue_scripts', 'mytheme_enqueue_front_page_scripts' );

operate ourWidgetInit(){

register_sidebar( array (
'title' => 'Sidebar',
'id' => 'sidebar1',

));

register_sidebar( array (
    'title' => 'Desplegable',
    'id' => 'desplega1',
    'before_widget'=>'<div class="widget-item">',
    'after_widget'=> '</div>',
    'before_title'=>'<h6 class="category_title">',
    'after_title'=>'</h6>', 
    ));
}

add_action('widgets_init', 'ourWidgetInit');

//Añadir el thumbnail//
operate ah6studio_setup() {
    add_theme_support('post-thumbnails');
    add_theme_support('title-tag'); 
}
add_action('after_setup_theme','ah6studio_setup');

My plugin file ah6_postypes.php


<?php

operate ah6_papers() {
    register_post_type('papers', array(
        'has_archive'=> true,
        'public'=> true,
        'posts_per_page' => -1,
        'labels'=> array(
            'title'=>'Papers',
            'add_new'=> 'Agregar un Paper',
            'edit_item'=>'Editar un Paper',
            'all_items'=>'Todos los Papers',
            'singular_name'=>'Paper'
            
        ),
        'taxonomies' => array('temas'),
        'menu_icon'=>  'dashicons-media-text',
    ));
}

add_action('init', 'ah6_papers');


operate papers_categories() {
    //Taxonomía: TEMAS
    //Traducción para el backend

      $labels = array(
        'title' => _x( 'Temas', 'taxonomy normal title' ),
        'singular_name' => _( 'Tema', 'taxonomy singular title' ),
        'search_items' =>  __( 'Buscar tema' ),
        'all_items' => __( 'Todos los temas' ),
        'parent_item' => __( 'Tema padre' ),
        'parent_item_colon' => __( 'Tema padre:' ),
        'edit_item' => __( 'Editar tema' ), 
        'update_item' => __( 'Actualizar tema' ),
        'add_new_item' => __( 'Añadir nuevo tema' ),
        'new_item_name' => __( 'Nombre del nuevo tema' ),
        'menu_name' => __( 'Temas' ),
      );    
     
    // Registrando la taxonomía
      register_taxonomy('temas',array('papers'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'show_in_rest' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'temas' ),
      ));

      //Taxonomía: TERRITORIOS
    //Traducción para el backend

    $labels = array(
        'title' => _x( 'Territorios', 'taxonomy normal title' ),
        'singular_name' => _( 'Territorio', 'taxonomy singular title' ),
        'search_items' =>  __( 'Buscar territorio' ),
        'all_items' => __( 'Todos los territorios' ),
        'parent_item' => __( 'Territorio padre' ),
        'parent_item_colon' => __( 'Territorio padre:' ),
        'edit_item' => __( 'Editar territorio' ), 
        'update_item' => __( 'Actualizar territorio' ),
        'add_new_item' => __( 'Añadir nuevo territorio' ),
        'new_item_name' => __( 'Nombre del nuevo territorio' ),
        'menu_name' => __( 'Territorios' ),
      );    
     
    // Registrando la taxonomía
      register_taxonomy('territorios',array('papers'), array(
        'hierarchical' => true,
        'labels' => $labels,
        'show_ui' => true,
        'show_in_rest' => true,
        'show_admin_column' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'territorios' ),
      ));
     
    }

    add_action( 'init', 'papers_categories', 0 );