Forum Replies Created
-
AuthorPosts
-
martin75
ParticipantMany many thanks george i really do appreciate your time and help , i have entered the foloowing into my functions file but in the instructor field there is no box atall next to instructors ive attatched screen shot , i must be missing something here!
register_post_type( 'instructors', array( 'labels' => array( 'name' => 'Instructors', 'singular_name' => 'Instructor', 'singular_name_lowercase' => 'instructor' ), 'public' => true )); function tribe_link_instructors_to_events() { tribe_register_linked_post_type( 'instructors', array( 'singular_name' => 'Instructor', 'singular_name_lowercase' => 'Instructor', 'allow_multiple' => true, 'allow_creation' => true ) ); } add_action( 'init', 'tribe_link_instructors_to_events' ); /** * Saves the instructor information passed via an event. * * @param int|null $id ID of instructor * @param array $data The instructor data * @param string $post_type The post type * @param string $post_status The intended post status * * @return mixed */ function tribe_save_the_instructors_form_on_eventsXXX( $id, $data, $post_type, $post_status ) { // Check to see if we're updating an already-existing instructor post. if ( isset( $data['id'] ) && intval( $data['id'] ) > 0 ) { // We're updating an existing post, but only an ID was passed; no other data. // So, just return the ID. Do nothing. if ( count( $data ) == 1 ) { return $data['id']; } // Check out the Tribe__Events__Organizer->update() method for inspiration on how to make an "update" function. return example_update_instructor( $data['id'], $data ); } // Otherwise, we're not updating an existing instructor; we have to make a new instructor post. // Check out the Tribe__Events__Organizer->update() method for inspiration on how to make a "create" function. return example_create_instructor( $data, $post_status ); } /** * Modify the form for "Instructors" on the events edit screen. * * @param string $post_type The post type whose form is being modified. */ function tribe_modify_the_instructors_form_on_events( $post_type ) { // We only want the "Instructors" post type; bail if it's some other post type. if ( 'instructors' !== $post_type ) { return; } // Add a Table Row for the Instructor Website to show up below the Instructor Name. ?> <tr class="linked-post"> <td>Instructor Website:</td> <td> <input type='text' tabindex="<?php tribe_events_tab_index(); ?>" name='linked_instructors[website][]' class='linked-post-website instructors-website' size='25' value='' /> </td> </tr> <tr class="linked-post"> <td>Instructor Website 2:</td> <td> <input type='text' tabindex="<?php tribe_events_tab_index(); ?>" name='linked_instructors[website_2][]' class='linked-post-website-2 instructors-website-2' size='25' value='' /> </td> </tr> <?php } add_action( 'tribe_events_linked_post_new_form', 'tribe_modify_the_instructors_form_on_events' );also in wordpress back end the instructor field on the left in the image attatched , is not within the events on the left , should it be ?
thankyou
-
This reply was modified 8 years, 5 months ago by
martin75.
martin75
Participantthank you for the update George very much appreciated.
martin75
Participanti had exact same issue , i used the following to have full width calendar page ,and a matching theme page with sidebar for the event pages place it in the themes functions.php
function tribe_theme_template_chooser ( $template ) { if ( ! tribe_is_event() ) return $template; /* * Example for changing the template for the single-event page to custom-page-template.php * Template is usually set to /plugins/the-events-calendar/src/views/default-template.php * You might wish to include some things from that template in your custom one, such as * the function tribe_get_view() which helps format the content within your template. * You can modify this example to set the template for any tribe page. Month view could be * modified by instead using the tribe_is_month() condition. */ // Single event page if ( is_single() ) { $template = locate_template( 'single_event1.php' ); } return $template; } add_filter( 'template_include', 'tribe_theme_template_chooser', 11 );change single_event1.php to page.php or single.php or even default.php i had to try a few of the themes templates….
hope it helps may not work for your theme but it did for me (ps it didnt help with organizer or venues pages had to do it different for those) good luck-
This reply was modified 8 years, 5 months ago by
martin75.
martin75
Participantis that the end of the help here ?
martin75
Participantso i would need to create the-events-calendar/src/Tribe/instructor.php for starters i take it cliffe?
i would draw your attention to https://theeventscalendar.com/knowledgebase/abstract-post-types/ , especialy this piece here “Doing this before version 4.2 of The Events Calendar meant lots of extra custom coding, but since 4.2 you can add or remove event-related post types with just a few simple filters” i think this is a bit misleading i purchased the pro simply for this. at no pint have i managed to have a simple instructor box in the admin new event form that says create within the box. it now seems i need to be a doctor of .php rather than “but since 4.2 you can add or remove event-related post types with just a few simple filters” . very disapointed , i know now this will never be achieved. thanks for your time
martin75
ParticipantHi Cliff did you manage a peak into this ? this is the one thing i really bought pro version for especially as it had a guide of how to accomplish it for a novice like myself , im literally waiting on this to publish my site. may thx in advance
martin75
Participantalso please note all plugins disabled except for the events calendar and pro , and themes 2014.15.16 and 2017 tried whilst plugins disabled.
exactly that Cliff, i followed this , i also added this i had to take out a “)” on line 45 or i had syntax error.hope this adds the snippet correct !
register_post_type( 'instructors', array( 'labels' => array( 'name' => 'Instructors', 'singular_name' => 'Instructor', 'singular_name_lowercase' => 'instructor' ), 'public' => true )); function tribe_link_instructors_to_events() { tribe_register_linked_post_type( 'instructors', array( 'singular_name' => 'Instructor', 'singular_name_lowercase' => 'Instructor', 'allow_multiple' => true, 'allow_creation' => true ) ); } add_action( 'init', 'tribe_link_instructors_to_events' ); /** * Modify the form for "Instructors" on the events edit screen. * * @param string $post_type The post type whose form is being modified. */ function tribe_modify_the_instructors_form_on_events( $post_type ) { // We only want the "Instructors" post type; bail if it's some other post type. if ( 'instructors' !== $post_type ) { return; } // Add a Table Row for the Instructor Website to show up below the Instructor Name. ?> <tr class="linked-post"> <td>Instructor Website:</td> <td> <input type='text' tabindex="<?php tribe_events_tab_index(); ?>" name='linked_instructors[website][]' class='linked-post-website instructors-website' size='25' value='' /> </td> </tr> <tr class="linked-post"> <td>Instructor Website 2:</td> <td> <input type='text' tabindex="<?php tribe_events_tab_index(); ?>" name='linked_instructors[website][]' class='linked-post-website instructors-website' size='25' value='' /> </td> </tr> <?php } add_action( 'tribe_events_linked_post_new_form', 'tribe_modify_the_instructors_form_on_events' ); /** * Saves the instructor information passed via an event. * * @param int|null $id ID of instructor * @param array $data The instructor data * @param string $post_type The post type * @param string $post_status The intended post status * * @return mixed */ function tribe_save_the_instructors_form_on_events( $id, $data, $post_type, $post_status ) { // Check to see if we're updating an already-existing instructor post. if ( isset( $data['id'] ) && intval( $data['id'] ) > 0 ) { // We're updating an existing post, but only an ID was passed; no other data. // So, just return the ID. Do nothing. if ( count( $data ) == 1 ) { return $data['id']; } // Check out the Tribe__Events__Organizer->update() method for inspiration on how to make an "update" function. return example_update_instructor( $data['id'], $data ); } // Otherwise, we're not updating an existing instructor; we have to make a new instructor post. // Check out the Tribe__Events__Organizer->update() method for inspiration on how to make a "create" function. return example_create_instructor( $data, $post_status ); }-
This reply was modified 8 years, 5 months ago by
martin75.
martin75
Participantmany many thanks Cliffe it works absolutky spot on , i also added the following in functions.php to make the same changes to organizers (just in case anyone is ever interested) events,venue and organizers now have stand alone comments , i cant thank you enough!! sort abstract post out and site can go live!!
/**
* The Events Calendar PRO: enable comments on single organizer pages.
*
* @link https://theeventscalendar.com/support/forums/topic/comments-on-organizer-and-venue/
*/
add_filter( ‘tribe_events_register_organizer_type_args’, function ( $args ) {
$args[‘supports’][] = ‘comments’;return $args;
} );/**
* Force “Allow Comments” to TRUE for all organizers.
*/
add_filter( ‘comments_open’, function ( $open, $post_id ) {
if (
function_exists( ‘tribe_is_organizer’ )
&& tribe_is_organizer( $post_id )
) {
return true;
} else {
return $open;
}
}, 10, 2 );/**
* Load the Comments Form on the organizer single page. Quite a bit of hackery to
* accomplish this, but it should work reliably.
*/
add_action( ‘tribe_events_single_organizer_after_upcoming_events’, function () {
/**
* Needed because of the comment form’sglobal $idandglobal $post
* thinking it’s an event, not a venue. Possibly a bug in the Venue single
* page but maybe not.
*/
wp_reset_postdata();/**
* Remove TEC’s hijacking of the comments template so it’s no longer
* /wp-content/plugins/the-events-calendar/src/admin-views/no-comments.php
* and therefore we get to use the theme’s comments.php file, as expected.
*
* comments_template() is not needed to load the comments form because it is
* already loading after removing TEC’s hijacking of the comments template.
*/
remove_filter( ‘comments_template’, array( ‘Tribe__Events__Template_Factory’, ‘remove_comments_template’ ) );
remove_filter( ‘comments_template’, array( ‘Tribe__Events__Templates’, ‘load_ecp_comments_page_template’ ) );
} );-
This reply was modified 8 years, 5 months ago by
martin75.
martin75
Participantcreate or find an instructor is not present as you see from the picture , so no way it can be saved ? timely response would be appreciated
-
This reply was modified 8 years, 5 months ago by
-
AuthorPosts
