• Hey, I am creating new post types but when I try to use the archive page it doesn’t work:

    function isc_custom_types_register(){
    
    		// Taxonomies
    
    		$labels = array(
    			'name' 							=> _x('Tipo','taxonomy general name','tipo'),
    			'singular_name' 				=> _x('Tipo','taxonomy singular name','tipo'),
    			'search_items' 					=> __('Buscar tipo','tipo'),
    			'popular_items'					=> __('Tipos más populares','tipo' ),
    			'all_items' 					=> __('Todos los tipos','tipo'),
    			'parent_item'                 	=> __('Parent tipo','tipo'),
    			'edit_item' 					=> __('Editar tipo','tipo'),
    			'update_item' 					=> __('Actualizar tipo','tipo'),
    			'add_new_item' 					=> __('A?adir tipo','tipo'),
    			'new_item_name' 				=> __('Nuevo tipo','tipo'),
    			'add_or_remove_items'			=> __('A?adir o eliminar tipo','tipo')
    
    		);
    
    		$args = array(
    		    'label'                         => __('Tipos', 'tipo' ),
    		    'labels'                        => $labels,
    		    'public'                        => true,
    		    'hierarchical'                  => true,
    		    'show_ui'                       => true,
    		    'show_in_nav_menus'             => true,
    		    'rewrite'                       => array( 'slug' => 'tipo', 'with_front' => true ),
    		    'query_var'                     => true,
    		);
    
    		register_taxonomy( 'tipo', 'proyecto', $args );
    
    		// Custom post types
    
    		$labels = array(
    			'name' 					=> _x('Proyectos','post type general name','proyecto'),
    			'singular_name'			=> _x('Proyecto','post type singular name','proyecto'),
    			'add_new' 				=> _x('A?adir Proyecto','portfolio','proyecto'),
    			'add_new_item'			=> __('A?adir Proyecto','proyecto'),
    			'edit_item'				=> __('Edit Proyecto','proyecto'),
    			'new_item'				=> __('Nueva Proyecto','proyecto'),
    			'view_item'				=> __('Ver Proyecto','proyecto'),
    			'search_items'			=> __('Buscar Proyectos','proyecto'),
    			'not_found' 			=> __('No se han encotrado proyectos','proyecto'),
    			'not_found_in_trash' 	=> __('No hay proyectos en la basura','proyecto')
    		);
    
    		$args = array(
    	        'labels'                => $labels,
    	        'public'                => true,
    	        'show_ui'               => true,
    	        'query_var' 			=> true,
    	        'show_in_menu'          => true,
    	        'menu_position' 		=> 4,
    	        'capability_type' 		=> 'post',
    	        'supports'              => array( 'title', 'thumbnail', 'page-attributes', 'order' ),
    	        'rewrite'               => array( 'slug' => 'proyecto', 'with_front' => true ),
    	        'has_archive'           => true,
    	    );
    
    		register_post_type( 'proyecto' , $args );
    
    	}
    
    	add_action( 'init', 'isc_custom_types_register' );

    This code below is placed in archive.php and it doesn’t show the title of the taxonomy. It shows the title of the first post.
    domain.com/tipo/whatever

    <?php the_title( '<h1 class="title-servicios">', '</h1>' ); ?>

    Could somebody help?

    Thanks!

Viewing 3 replies - 1 through 3 (of 3 total)
  • lisa

    (@contentiskey)

    can you define “archive page it doesn’t work”.
    are you getting an error?
    page not found?
    etc?

    Thread Starter mseculi

    (@mseculi)

    Hi contentiskey,

    Sorry, I made some mistakes. Archive page is shown fine, but there are two errors:

    1. The loop is not working, it just shows the first loop.

    2. The_title() written before the loop shows “the title of the first post” instead “the title of the page”.

    Thank you!

    lisa

    (@contentiskey)

    can you share the link to the completed page that you are working on that has the errors?
    can you share the code in your loop file and template file?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom type post -> Archive page not working’ is closed to new replies.