0

I've been following a tutorial on how to create a template in wordpress and I've found myself stuck in a problem.

My custom blog type: Project, when I click on it after adding some styling on the index.php page, doesn't seem to work, as it says on the browser nav tab "Page not found". The weird part is that it was supposed to be taking the same styles as the blog page (which works correctly) but nothing happens. after that I've tried to create a archive.php file to see if it would pull from that, but nothing happen.

the custom blog type was created succesfully as it is on my admin menu options and I've created posts that are shown. But I'm not being able to access it when clicking on it.

I've already tried going to settings -> permalink and saving, but remains the same, is there something that I might need to check?

Here's the code for the function that I've created:

// Project post type

function ep_custom_post_type(){
  register_post_type( 'project', 
  array(
    'rewrite' => array('slug' => 'projects'),
    'labels' => array(
      'name' => 'Projects',
      'singular_name' => 'Project',
      'add_new_item' => 'Add New Project',
      'edit_item' => 'Edit Project',
    ),
    'menu_icon' => 'dashicons-clipboard',
    'public' => true,
    'has_archve' => true,
    'supports' => array(
      'title','thumbnail','editor','excerpt', 'comments'
    ) 
  )
    );  
} 
add_action( 'init','ep_custom_post_type');

?>

And this is the while loop on the index.php that should work for both blog page and project page:

<?php get_header(  ); ?>

<main>  
  <a href="<?php echo site_url('/blog'); ?>">
    <h2 class="page-heading"> Todos los blogs</h2>
  </a>

  <section>

  <?php 


  while (have_posts(  )){
    the_post(  );


  ?>

What should I check next? is there a setting on permalink that I should be looking into?

Thank you so much for your help!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.