Abstract Post Types – 70% there – but last hurdle to cross

Home Forums Calendar Products Events Calendar PRO Abstract Post Types – 70% there – but last hurdle to cross

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1425863
    David
    Participant

    I’ve made some great progress with Abstract Post Types – but have now hit a wall

    I have added the post types – got them linked and showing in the edit event screen nicely

    If I select from some previously created linked Abstract Post Types, they save!

    All so good so far

    Now – the issues

    Does anyone have a code snippet for quickly outputting the linked Abstract Post Type to a UL? I guess I need to use tribe_get_linked_post_types or tribe_has_linked_posts_by_post_type

    And the other issue, I have enabled creation of the post types from the event screen – so it should work in the same way as venues do – but it doesn’t – it doesn’t save at all when I save the main event – is there something obvious that I have missed?

    My code snippet is as per below

    `// Register Custom Post Type
    function register_included_element() {

    $labels = array(
        'name'                  => 'Included Element',
        'singular_name'         => 'included-element',
        'singular_name_lowercase'=> 'included-element',
        'menu_name'             => 'Included Elements',
        'name_admin_bar'        => 'Included Element',
        'archives'              => 'Included Element Archives',
        'attributes'            => 'Included Element Attributes',
        'parent_item_colon'     => 'Parent Included Element:',
        'all_items'             => 'Included Elements',
        'add_new_item'          => 'Add New Included Element',
        'add_new'               => 'Add New',
        'new_item'              => 'New Included Element',
        'edit_item'             => 'Edit Included Element',
        'update_item'           => 'Update Included Element',
        'view_item'             => 'View Included Element',
        'view_items'            => 'View Included Elements',
        'search_items'          => 'Search Included Element',
        'not_found'             => 'Not found',
        'not_found_in_trash'    => 'Not found in Trash',
        'featured_image'        => 'Featured Image',
        'set_featured_image'    => 'Set featured image',
        'remove_featured_image' => 'Remove featured image',
        'use_featured_image'    => 'Use as featured image',
        'insert_into_item'      => 'Insert into Included Element',
        'uploaded_to_this_item' => 'Uploaded to this Included Element',
        'items_list'            => 'Included Elements list',
        'items_list_navigation' => 'Included Elements list navigation',
        'filter_items_list'     => 'Filter Included Elements list',
    );
    $args = array(
        'label'                 => 'Included Element',
        'labels'                => $labels,
        'supports'              => array('title', 'editor'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => "/edit.php?post_type=tribe_events",
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-menu',
        'show_in_admin_bar'     => false,
        'show_in_nav_menus'     => false,
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => true,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    
    register_post_type( 'included-element', $args );
    

    }

    // Register Custom Post Type
    function register_excluded_element() {

    $labels = array(
        'name'                  => 'Excluded Element',
        'singular_name'         => 'excluded-element',
        'singular_name_lowercase'=> 'excluded-element',
        'menu_name'             => 'Excluded Elements',
        'name_admin_bar'        => 'Excluded Element',
        'archives'              => 'Excluded Element Archives',
        'attributes'            => 'Excluded Element Attributes',
        'parent_item_colon'     => 'Parent Excluded Element:',
        'all_items'             => 'Excluded Elements',
        'add_new_item'          => 'Add New Excluded Element',
        'add_new'               => 'Add New',
        'new_item'              => 'New Excluded Element',
        'edit_item'             => 'Edit Excluded Element',
        'update_item'           => 'Update Excluded Element',
        'view_item'             => 'View Excluded Element',
        'view_items'            => 'View Excluded Elements',
        'search_items'          => 'Search Excluded Element',
        'not_found'             => 'Not found',
        'not_found_in_trash'    => 'Not found in Trash',
        'featured_image'        => 'Featured Image',
        'set_featured_image'    => 'Set featured image',
        'remove_featured_image' => 'Remove featured image',
        'use_featured_image'    => 'Use as featured image',
        'insert_into_item'      => 'Insert into Excluded Element',
        'uploaded_to_this_item' => 'Uploaded to this Excluded Element',
        'items_list'            => 'Excluded Elements list',
        'items_list_navigation' => 'Excluded Elements list navigation',
        'filter_items_list'     => 'Filter Excluded Elements list',
    );
    $args = array(
        'label'                 => 'Excluded Element',
        'labels'                => $labels,
        'supports'              => array('title', 'editor'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => "/edit.php?post_type=tribe_events",
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-menu',
        'show_in_admin_bar'     => false,
        'show_in_nav_menus'     => false,
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => true,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    
    register_post_type( 'excluded-element', $args );
    

    }

    function register_testimonial_snippet() {

    $labels = array(
        'name'                  => 'Testimonial Snippet',
        'singular_name'         => 'testimonial-snippet',
        'singular_name_lowercase'=> 'testimonial-snippet',
        'menu_name'             => 'Testimonial Snippets',
        'name_admin_bar'        => 'Testimonial Snippet',
        'archives'              => 'Testimonial Snippet Archives',
        'attributes'            => 'Testimonial Snippet Attributes',
        'parent_item_colon'     => 'Parent Testimonial Snippet:',
        'all_items'             => 'Testimonial Snippets',
        'add_new_item'          => 'Add New Testimonial Snippet',
        'add_new'               => 'Add New',
        'new_item'              => 'New Testimonial Snippet',
        'edit_item'             => 'Edit Testimonial Snippet',
        'update_item'           => 'Update Testimonial Snippet',
        'view_item'             => 'View Testimonial Snippet',
        'view_items'            => 'View Testimonial Snippets',
        'search_items'          => 'Search Testimonial Snippet',
        'not_found'             => 'Not found',
        'not_found_in_trash'    => 'Not found in Trash',
        'featured_image'        => 'Featured Image',
        'set_featured_image'    => 'Set featured image',
        'remove_featured_image' => 'Remove featured image',
        'use_featured_image'    => 'Use as featured image',
        'insert_into_item'      => 'Insert into Testimonial Snippet',
        'uploaded_to_this_item' => 'Uploaded to this Testimonial Snippet',
        'items_list'            => 'Testimonial Snippets list',
        'items_list_navigation' => 'Testimonial Snippets list navigation',
        'filter_items_list'     => 'Filter Testimonial Snippets list',
    );
    $args = array(
        'label'                 => 'Testimonial Snippet',
        'labels'                => $labels,
        'supports'              => array('title', 'editor'),
        'hierarchical'          => false,
        'public'                => true,
        'show_ui'               => true,
        'show_in_menu'          => "/edit.php?post_type=tribe_events",
        'menu_position'         => 5,
        'menu_icon'             => 'dashicons-menu',
        'show_in_admin_bar'     => false,
        'show_in_nav_menus'     => false,
        'can_export'            => true,
        'has_archive'           => false,
        'exclude_from_search'   => true,
        'publicly_queryable'    => true,
        'capability_type'       => 'page',
    );
    
    register_post_type( 'testimonial-snippet', $args );
    

    }

    function link_excluded_elements_to_events() {
    tribe_register_linked_post_type( ‘excluded-element’, array(
    singular_name => ‘Excluded Element’,
    singular_name_lowercase => ‘excluded element’,
    allow_multiple => true,
    allow_creation => true
    )
    );
    }

    function link_included_elements_to_events() {
    tribe_register_linked_post_type( ‘included-element’, array(
    singular_name => ‘Included Element’,
    singular_name_lowercase => ‘included element’,
    allow_multiple => true,
    allow_creation => true
    ));
    }

    function link_testimonial_snippets_to_events() {
    tribe_register_linked_post_type( ‘testimonial-snippet’, array(
    singular_name => ‘Testimonial Snippet’,
    singular_name_lowercase => ‘testimonial snippet’,
    allow_multiple => true,
    allow_creation => true
    ));
    }

    add_action( ‘init’, ‘register_included_element’, 0 );
    add_action( ‘init’, ‘register_excluded_element’, 0 );
    add_action( ‘init’, ‘register_testimonial_snippet’, 0 );

    add_action( ‘init’, ‘link_included_elements_to_events’ );
    add_action( ‘init’, ‘link_excluded_elements_to_events’ );
    add_action( ‘init’, ‘link_testimonial_snippets_to_events’ );`

    #1427125
    Cliff
    Member

    Hi, David. Good effort and good timing!

    I’m actually working on an Extension for to make this easier for you… please visit https://github.com/mt-support/tribe-ext-instructors-linked-post-type and follow along its “TODO” items inside the code.

    It’s currently working but isn’t finished. I’ll post an update here once it is, but what’s there now should be able to get you over the finish line right now.

    Please let me know how this goes for you.

    #1427932
    David
    Participant

    I couldn’t get your example to work as is – which was odd – but no matter, I pulled it apart and now have shortcodes for listing Abstract Post Types – which is awesome

    But I still have two issues – one is new – the linked Abstract Posts show in the correct order in the back-end – but when displayed using tribe_get_linked_post_types they are coming out in alphabetical order – which is not what I want – how do I change this please?

    And I still cannot create a new linked post type within the edit event screen – it never does save – I must have missed something major – it is a very simple type, that just has a post title

    #1428237
    Cliff
    Member

    https://github.com/mt-support/tribe-ext-instructor-linked-post-type (which has been modified significantly since my last reply) was and still is working for me and another user as-is. Again, it’s not yet complete, though.

    I’d suggest making sure you’re running the latest versions of our plugins and then try to get this one working as-is without any other linked post types in play.

    Could you please make sure all your Modern Tribe plugins (and WordPress core) are at their latest versions?

    Once you verify you’re on the latest versions, please test to see if the issue is still happening for you.

    #1446463
    Support Droid
    Keymaster

    Hey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.

    Thanks so much!
    The Events Calendar Support Team

    #1465907
    Cliff
    Member

    David, sorry for your dissatisfaction here.

    This is an advanced part of our system and I pointed you to the best resource we have at this time. Hopefully you got what you needed by now. If not, feel free to open a new help desk ticket.

    #1481501
    Cliff
    Member

    Hi, David.

    Good news! We’ve significantly modified our Knowledgebase article about Linked Post Types (previously called Abstract Post Types).

    We’ve even provided a working example plugin to get you started.

    Please review it afresh at https://theeventscalendar.com/knowledgebase/linked-post-types/ and open a new support thread if you have any follow-up questions.

    Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Abstract Post Types – 70% there – but last hurdle to cross’ is closed to new replies.