Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1327459

    kaynmafc
    Participant

    I am using Icon

    I am trying to make a CPT for a “Project” and then have a “Projects Page” where all the individual projects are listed and displayed.

    So far I have done the following:

    Added the following code to functions.php in my child theme:

    function projects_init() {
    
        $labels = array(
       'name' => __( 'Projects' ),
       'singular_name' => __( 'Project' ),
       'all_items' => __('All Projects'),
       'add_new' => _x('Add New Project', 'Projects'),
       'add_new_item' => __('Add New Project'),
       'edit_item' => __('Edit Project'),
       'new_item' => __('New Project'),
       'view_item' => __('View Project'),
       'search_items' => __('Search in Projects'),
       'not_found' =>  __('No Projects found'),
       'not_found_in_trash' => __('No Projects found in trash'),
       'parent_item_colon' => ''
       );
    
        $args = array(
          'labels' => $labels,
            'public' => true,
            'show_ui' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
            'has_archive' => true,
            'rewrite' => array('slug' => 'projects'),
            'query_var' => true,
            'menu_icon' => 'dashicons-hammer',
            'supports' => array(
                'title',
                'editor',
                'excerpt',
                'trackbacks',
                'custom-fields',
                'comments',
                'revisions',
                'thumbnail',
                'author',
                'page-attributes',)
            );
        register_post_type( 'projects', $args );
    }
    add_action( 'init', 'projects_init' );

    Next, I made a couple ‘test projects’ through the dashboard of my site. The projects were created successfully, and the interface to make them on the dashboard worked correctly.

    Next, I made a “Projects” page through the dashboard. This is the page I would like to display a listing of all ‘projects’

    Next, I made sure there was a “Projects” tab in appearance->menus.

    Next, Everything starts going off the rails. I have tried doing the things listed in these posts:

    https://community.theme.co/forums/topic/custom-post-type-list-page-template/ (answer was vague, tried but it didnt work)

    https://community.theme.co/forums/topic/custom-template-for-custom-taxonomy-archive/ (did exactly what ebrammer said, but no projects show up on my Projects page)

    https://www.elegantthemes.com/blog/tips-tricks/creating-custom-post-types-in-wordpress (followed this tutorial up till Step 4. They say to use page.php. They also point out that you need to add this:

    /**
     * Template Name: Projects
     **/

    In order for WP to recognize it as a template….is this true?

    I’m assuming since I want a page that displays a listing of all projects, that I need to make an archive-projects.php, which is based off index.php (from what I gather).

    I also assume that since in Xtheme parent there is always code in both the functions.php AND the view for Icon, that however I get this to work….I’ll need to put code in the x-child for BOTH the functions.php and the view folder for Icon.

    I’ve tried lots of configurations with making single-projects.php, archive-projects.php, page-projects.php….nothing has worked so far.

    If anyone could please give me a detailed walk-through for how to get a listitng of my CPTs to display on a single page of my website, I would greatly appreciate it!!!!

    Thanks for any help in advance!

    #1327829

    Nico
    Moderator

    Hi There,

    Thanks for writing in.

    In this case, first, Would you mind providing us with login credentials so we can take a closer look? To do this, you can make a post with the following info:

    – Link to your site
    – WordPress Admin username / password
    – FTP credentials

    Don’t forget to select Set as private reply. This ensures your information is only visible to our staff.

    Thanks.

    #1327894

    kaynmafc
    Participant
    This reply has been marked as private.
    #1327901

    kaynmafc
    Participant
    This reply has been marked as private.
    #1328204

    kaynmafc
    Participant
    This reply has been marked as private.
    #1328268

    kaynmafc
    Participant
    This reply has been marked as private.
    #1328308

    Rad
    Moderator

    Hi there,

    We’re not working on it. And we usually request site backup before doing anything. We don’t switch theme and disable plugins without permission from the owner.

    Since it seems someone is working on it, then I’m not going to check it yet. Please restore it to how it’s used to be.

    Thanks!