Tuesday, September 13, 2022
HomeWordPress Developmentfeatures - Customized Publish Varieties utilizing flawed template (index) as an alternative...

features – Customized Publish Varieties utilizing flawed template (index) as an alternative of archive-{sort}.php – beforehand labored as anticipated


I’ve a number of customized submit varieties on a website the place top-level nav gadgets use archive-{post-type}.php templates of the submit varieties. These have lately had a template downside they usually now use the index.php template, as an alternative of their archive template. That is probably after I added a customized taxonomy to the top of features.php (beneath), however solely as a result of that is the latest important change to features. They nonetheless use the right archive templates on our manufacturing website, however not on the event website, the place modifications have been made.

I’ve tried eradicating the taxonomy motion, no change.

I’ve tried saving permalinks in admin settings, no change.

Additionally perhaps related: this additionally solely impacts top-level templates – there are a number of customized submit varieties with rewrites to eg area.com/media-center/articles – and the articles for these work as anticipated.

I’ve not confronted this problem earlier than and have not but discovered any options that resolve it. Is there something that I can verify that is likely to be inflicting it – or a solution to unravel the problem?

The lately added taxonomy:

add_action( 'init', 'create_year_taxonomy' );
perform create_year_taxonomy() {
  
  // translations for GUI
  $labels = array(
    'identify' => _x( 'Version 12 months', 'taxonomy basic identify' ),
    'singular_name' => _x( '12 months', 'taxonomy singular identify' ),
    'search_items' =>  __( 'Search Years' ),
    'all_items' => __( 'All Years' ),
    'parent_item' => __( 'Mother or father 12 months' ),
    'edit_item' => __( 'Edit 12 months' ), 
    'update_item' => __( 'Replace 12 months' ),
    'add_new_item' => __( 'Add New 12 months' ),
    'new_item_name' => __( 'New 12 months' ),
    'menu_name' => __( 'Years' ),
  );    
  
  // register the taxonomy
  register_taxonomy('yr',array('the_street_view'), array(
    'hierarchical' => true,
    'labels' => $labels,
    'show_ui' => true,
    'show_in_rest' => true,
    'show_admin_column' => true,
    'query_var' => true,
    'rewrite' => array( 'slug' => 'yr' ),
  ));
}

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments