Support has been upgraded!
The Support Forum is closed. Not to worry! Providing the top quality support you expect and we're known for will continue! We're not ending support, just changing where you submit requests. This will provide you with the best experience possible.
Premium Support
Have you purchased an addon for Connections such as one of our premium templates or extensions with a valid license and you need help?
Please open a Support Ticket in your user account.
Free Support
Are you using the free Connections plugin? Don't worry, you are still very important to us! We are still providing you with the same high quality support that we're known for.
Please open a new support topic in the WordPress support forums for Connections.
Tagged: 8.7.1
- This topic has 7 replies, 2 voices, and was last updated 8 years, 8 months ago by
Steven Zahm.
-
AuthorPosts
-
12/20/2017 at 9:36 pm #444870
Bishop Gregory Godsey
GuestHello,
I am using the Code Snippet plugin to add custom dates to the list of dates. I was wondering if there is a way to add a text field to certain types of dates. For example:
Diaconate Ordination date:
Bishop who ordained them: (with text entry)We would have several for like priest, deacon and bishop, but would only need the one text field for each date. We would like to not display the text field for any of the other dates like birthdays and the like.
Thank you for your help!
Bishop Gregory Godsey
12/21/2017 at 9:13 am #444935Steven Zahm
Keymaster@ Bishop Gregory Godsey
Sorry, no, there is no way to add text fields to specific date types or any date type all all.
Probably the only way to handle this would be to add a new metabox (section) which would have three date pickers and their related text boxes. These would not be what Connections considers dates but may work for what you need to do. This is quite a bit more difficult when compared to adding custom date types that you already have done. I do offer custom development services if you are interested. Let me know.
12/21/2017 at 2:04 pm #444952Bishop Gregory Godsey
GuestThanks for the reply. So how would I go about adding a date picker and meta box like that? I am building this for a non-profit. I am doing it all on a volunteer basis. Any help you can provide would be appreciated.
Thank you!
BG
12/21/2017 at 3:16 pm #444957Bishop Gregory Godsey
GuestI have the following in snippets:
// Register the metabox and field. add_action( 'cn_metabox', 'cn_register_priest_ordo' ); function cn_register_priest_ordo() { $atts = array( 'title' => 'Priesthood Ordination Date', 'id' => 'priest_ordo_date_metabox', 'context' => 'normal', 'priority' => 'core', 'fields' => array( array( 'name' => 'Date', 'show_label' => TRUE, 'id' => 'priest_ordo_date', 'type' => 'datepicker', ), array( 'name' => 'Ordaining Bishop', 'show_label' => TRUE, 'id' => 'priest_ordain_bishop', 'type' => 'text', 'size' => 'regular', ), ), ); cnMetaboxAPI::add( $atts ); }However, it does not keep the date. It resets to 01/01/1970 each time I save it.
Also, I cannot get it to display on the entry. I created a child template and inserted this:
$datepicker = $entry->getMeta( array( 'key' => 'priest_ordo_date', 'single' => TRUE ) ); if ( ! empty( $datepicker ) ) echo '' . esc_html( $datepicker ) . ''; $text = $entry->getMeta( array( 'key' => 'priest_ordain_bishop', 'single' => TRUE ) ); if ( ! empty( $text ) ) echo '' . esc_html( $text ) . '';But it does not display on the entry in the front end.
Thanks!
BG
12/21/2017 at 4:39 pm #444966Bishop Gregory Godsey
GuestLast question. I managed to get the info to display on the default card template using the code I put above. However, it displays as:
DateName of Bishop.
Just like that. And the date is dd/mm/yyyy. I would like to display it like this:
Priest Ordination: 21 June 2017 by Name of Bishop
Is there a way to do that?
Thank you for your patience!
BG
12/21/2017 at 5:06 pm #444971Steven Zahm
KeymasterRE: it does not keep the date. It resets to 01/01/1970 each time I save it.
I copied/pasted your code into a snippet as is since it looks correct at a glance. It seems to work just fine. Perhaps the date format set on the WordPress General Settings admin page is incompatible. I suggest using one of the default fate formats vs. using a custom date format.
RE: display
Try this:
$datepicker = $entry->getMeta( array( 'key' => 'priest_ordo_date', 'single' => TRUE ) ); $text = $entry->getMeta( array( 'key' => 'priest_ordain_bishop', 'single' => TRUE ) ); if ( ! empty( $datepicker ) && ! empty( $$text ) ) { $date = cnDate::createFromFormat( 'd/m/Y', $datepicker )->format( 'j F Y' ); echo '<strong>Priest Ordination:</strong>' . $date . ' by ' . $text; }12/21/2017 at 5:21 pm #444978Bishop Gregory Godsey
GuestThat worked perfect! Thank you so much! Merry Christmas!
BG
12/21/2017 at 5:25 pm #444979Steven Zahm
KeymasterGreat to hear!
Merry Christmas!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
