Skip Navigation

[Closed] Archive page for custom post type created by another plugin

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 6 years, 4 months ago.

Assigned support staff: Luo Yang.

Author
Posts
#321928
create-archive-modal.png

I am trying to: Create a View WP Archive for custom post type tribe_organizer and tribe_event which are created by the Modern Tribe Event Calendar plugin. By Default these post types DO NOT have archives enabled so I have re-registered them by using this code in my theme function page

  //re-register tribe_organizer to allow for archive pages
function update_tribe_organizer_post_type() {
    register_post_type('tribe_organizer',
        array(
            'labels' => array (
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array(
                'slug' => 'organizers',
                'with_front' => false,
            ),
            'supports' => array(
                'title',
            )
        )
    );
}
add_action( 'init', 'update_tribe_organizer_post_type');
      
  //re-register tribe_venue to allow for archive pages
function update_tribe_venue_post_type() {
    register_post_type('tribe_venue',
        array(
            'labels' => array (
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array(
                'slug' => 'venues',
                'with_front' => false,
            ),
            'supports' => array(
                'title',
            )
        )
    );
}
add_action( 'init', 'update_tribe_venue_post_type');

This does allow me to view the default archive page by adding either /venues or /organizers. So far so good

I visited this URL: Add new WordPress Archive page

I expected to see: Two new checkboxes for both VENUES and ORGANIZERS that I can then select to create a views wp archive
Instead, I got: the only checkbox that has been added is one for POSTS. Have I missed something in my re-register code? Thanks

#321998

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

1.png

Dear frank,

Please try this:
1) make sure you are using the latest stable version of Views,
2) modify your PHP codes, add parameter 'labels' to the PHP codes, like this:

<?php

//re-register tribe_organizer to allow for archive pages
function update_tribe_organizer_post_type() {
    register_post_type('tribe_organizer',
        array(
            'labels' => array (
				'name' => 'organizers', //add two lines
				'singular_name' => 'organizer',
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array(
                'slug' => 'organizers',
                'with_front' => false,
            ),
            'supports' => array(
                'title',
            )
        )
    );
}
add_action( 'init', 'update_tribe_organizer_post_type');
       
  //re-register tribe_venue to allow for archive pages
function update_tribe_venue_post_type() {
    register_post_type('tribe_venue',
        array(
            'labels' => array (
				'name' => 'venues', //add two lines
				'singular_name' => 'venue',
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array(
                'slug' => 'venues',
                'with_front' => false,
            ),
            'supports' => array(
                'title',
            )
        )
    );
}
add_action( 'init', 'update_tribe_venue_post_type');

Above codes works in my localhost:
see screenshot 1.png

#322138

Thank you. Using this code I am now able to see 'organizers'. 'Venues' are still not showing. I've reversed the order as well with 'venues' afirst' that made no difference.

#322404

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

As the screenshot I mentioned above, I can not duplicate same problem, please try this:
1) Deactivate other plugins and switch to wordpress default theme, and test again.
2) If the problem still exists, please duplicate same problem in a test site, and fill below private detail box with login details, also point out where I can edit the PHP codes, I need a live website to debug this problem, thanks

The topic ‘[Closed] Archive page for custom post type created by another plugin’ is closed to new replies.