Forum Replies Created
-
AuthorPosts
-
martin75
Participantto add answer as none came my way and it may help others (you seriously need to look at listing and marking all the things that no longer work , its horrid trawling through updates((that are also horrid to find)) to find the accused bit of code) tribe_get_custom_field is now tribe_get_custom_fields add an S to end and all is well again!!
martin75
Participanti have accepted defeat gracefully ! I have now change default template to the above template and all works fine i have changed the organizer and venue template call no problem and the single event .
for organiser and venue i have used<?php if ( is_single() && tribe_is_event_organizer() ) { get_template_part( 'organizer_template' ); return; } if ( is_single() && tribe_is_event_venue() ) { get_template_part( 'venue_template' ); return; }both work fine.
for single page i used
`// Single event page
if ( is_single() ) {
$template = locate_template( ‘single_event1.php’ );
}
now the big question what would i use to call a different template for the tribe-ext-instructor-linked-post-type ?thought a good place to ask as you made that linked post type masterpiece!martin75
Participantmany thanks Cliffe i tried this , with no success
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' ); } if ( tribe_is_month() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template; $is_map_view = ( tribe_is_map() || Tribe__Events__Pro__Main::instance()->is_pro_ajax_view_request( false, 'map' ) ); } if ( tribe_is_map() ) { $template = locate_template( 'tpl-full-width-with-google-ads.php' ); } return $template; add_filter( 'template_include', 'tribe_theme_template_chooser', 11 );the code is in my themes functions.php
thanks again Cliffe
martin75
Participantsorry i want to display it in widget
thanksmartin75
Participantwould there be a way to hide all other days except today via css?
martin75
ParticipantThis reply is private.
martin75
ParticipantThis reply is private.
martin75
Participantmany thanks cliff, i think you haveprovided me with more than enough to get this up and running , please accept my thanks!!
kind regards martinmartin75
Participantcliff i appreciate all you have done to help me !i dont want any more help coding just 3 little answers so i have something to work towards!! if you could spare 30 seconds to answer i would be eternally grateful simple yes and no will suffice!!
thanks again martin !!martin75
Participantmany many thanks george for your time and effort, unfortunately its not quite right , can you please answer a few questions for me to help me along ??i dare not ask you to do any more coding!! 😉
1) i try to create the instructor when adding event and i end up on a white screen and the event is never published all i can do is press back button.
2) i use a previously created instructor and the event is posted successful. how ever on the single event page there is no mention of instructor , should there be ? or do i need to add something to single-event.php to display the instructor details ?
3) when i get this all working can i click on an instructor like i can venue and organizer and it shows all the upcoming events for this instructor ?its so close now !! thx george
martin75
Participantok george i think it all works as it should up to this point i note in previous post this
Let us know if that helps at least get the “Create or Find” dropdown working!
As cliff noted, the “create” and “save” functions themselves are ones you’ll have to create, but I can offer some insight on that once we confirm the “Create or Find” dropdown is working for the Instructors linked post type…
…let us know what you find!
— George
so as i see it now thats where its up to . could you offer this insight into these functions?
thanks again
martin75
Participantok george i think it all works as it should up to this point i note in previous post this
Let us know if that helps at least get the “Create or Find” dropdown working!
As cliff noted, the “create” and “save” functions themselves are ones you’ll have to create, but I can offer some insight on that once we confirm the “Create or Find” dropdown is working for the Instructors linked post type…
…let us know what you find!
— George
so as i see it now thats where its up to . could you offer this insight into these functions?
thanks again
martin75
Participantheres the 5th image , was capped to 4 sorry
martin75
ParticipantHi george , sorry for the dealy replying , sick new born baby took prioity! ,
here is where im at exactly.
in my functions.php i have the following code , this is the only modification i have made.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_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' ); /** * 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 ); } add_action( 'tribe_events_linked_post_create_instructors', 'tribe_save_the_instructors_form_on_events', 10, 4 );this results in the following.
on the left panel in wordpress dashboard i have an instructor tab (see image for_george)
i can click on this and it opens a sub menu , instructors and add new.if i select add new , all i can do is type in title and also theres the standard wordpress text box , no other fields are present for me to create/edit or type in.
if i type in a title and hit publish then it is saved , but just a title. see image (for_george_2.jpg)
from here if i goto add new event i have the following boxes (for_george_3.jpg)
if i clcik on the box i get the following (for_george_4.jpg)
so far the instructor field within add event works as expected,i can select previously created instructors and if i type in to create i then get the 2 boxes to type into (for_george_5.jpg)so far so good when i hit publish the event , it doesn’t get published , and i am presented with a blank white page.
i hope that clears it up , i am presuming its because the functions example.etcetc dont exist , do these need to be added to the single.event.php in some way , its so close but for me and my knowledge its a long long way away!! the more i look into it and read this post back the more confused i become (i even printed it out ) :-0), it really is driving me mad, this simple field would drive new and repeat visitorss to my site.
as always thanks for your time , have a great day ,
p.s it acts the same way in 2012,13,14,15,6 and 2017 with just the events and pro plugins activemartin75
Participanthi George many thanks for the update firstly i really appreciate it and i also fully understand about custom coding and am sure its not viable to do so!!
i used the new gist in functions.php hers where im at . in the left pain of wp-admin i select instructor (it isn’t in the event section but stands alone) i can enter a title and then have the word press text/visual box to type whatever i like , i have no website box etc etc. regardless of this if i make 2 exaple instructors they are saved and published. if i now go to events i finally have create or select , i can select the 2 examles, but there are no other info except the name. ifi type a new name and click it i then have website boxes!! so close ey?? well if i make a test event and create a new instructor then hit publish i just get a white page and the event never gets published!! im presuming this has something to do with the example create instructor etc etc…. there isnt enough info available for me to continue this and i think its a lost cause unfortunately , such a shame . i feel with a better article it would be doable, an article start to finish with 2 demo fields functioning would be awesome for others as well as myself it has the makings of a wonderful feature!
i really wouldn’t push on this but just for your feedback ill make a few comments for the sake of the events calendar rather than my own gain,and please don’t take the wrong way. i purchased the pro version for this feature alone (and if i don’t end up with it functioning i wont be asking for a refund as i feel the free version warrants a good donation from myself anyhow) the knowledge base article on abstract post is somewhat misleading , it also eliminates simple things that are both useful and needed, ie the very last post you made! with that included i could of been at this same stage weeks ago!!! and not wasted your time and effort!! i would suggest a rework of that knowledge base article to make it a whole lot clearer as for me its a bit more than easy with a few filters!!
thanks again to both George and Cliff in your en devour to assist me
-
AuthorPosts
