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.
- This topic has 16 replies, 2 voices, and was last updated 10 years ago by
Steven Zahm.
-
AuthorPosts
-
07/29/2016 at 8:22 pm #384815
wemmons53
ParticipantAnother question. I added a couple lines of code to the tile-plus.pho file to add my own shortcode (show_family_detail) so I can turn it on/off as needed.
Can the tile-plus.php file be overridden like the card.php file?
Or is the a filter or action that can be added to include the new shortcode?
07/31/2016 at 7:23 pm #385044wemmons53
ParticipantFYI
I have been working on the function and have done some updates. The pastebin link above now has current version.
The problem I now have is that the array data for each individual is not being pulled, ie the get phone number block brings up the family record info, not the individual.
The individuals name and relation shows ie Husband: Firstname Lastname
but the if stmts to pull the individuals data displays the family record data instead.08/01/2016 at 10:46 am #385075Steven Zahm
Keymaster@ William
re: pastbin
The paste is marked as private so I can sot view it.
re: Can the tile-plus.php file be overridden like the card.php file?
Sorry, no, t can not be overridden.
re: Or is the a filter or action that can be added to include the new shortcode?
Yes, there is a filter, two actually. One to register the shortcode option and its default value and one to init it value (if needed). YOu can see how to do this right in the
tile-plus.phpfile. Look for the two line that begin withadd_filter( 'cn_list_atts_and then look at the callback functions as an example on how to do it.Hope that helps!
ps. It just occured to me… you could refer to the
../wp-content/plugins/connections/templates/members/template.phpfile as an example of how to do it too. This is a user contributed template that I included a long time ago. It is not the best code but it does have a section where it pulls in the entry details of family members.pss. I do offer customization services. If interested, contact me using the link at the very bottom of the page and we can discuss the project scope and get you a quote.
08/01/2016 at 2:49 pm #385106wemmons53
ParticipantPastebin now set to public. Sorry about that.
Looking at the members template you mentioned above, would this be a better route for me to make a template of my own? Looks like it has both the php and css files for that template. Look interesting. Will look at it in detail.
What I am actually trying to get now is just a clean printable directory. The church has specifics on how they wanted it to look.
I have what I need from the tile-plus template for all my online needs. That works great.
What I could make is a tile-print template to remove all the unnecessary info and display just what is needed to the printed directory. (and maybe set it up as a plugin).
Then I will donate the code if you would lie can pass it on like the members template if you like.
-
This reply was modified 10 years ago by
wemmons53.
08/01/2016 at 6:15 pm #385115Steven Zahm
Keymaster@ William
Here’s a working function:
function getFamilyMemberDetailsBlock( $atts, $entry ) { $defaults = array( 'container_tag' => 'ul', 'item_tag' => 'li', 'item_format' => '<%1$s class="cn-relation"><span class="cn-relation-label">%relation%</span>%separator% <span class="cn-relation-name notranslate">%name%</span></%1$s>', 'name_format' => '', 'separator' => ':', 'before' => '', 'after' => '', 'before_item' => '', 'after_item' => '', 'return' => FALSE, ); $atts = wp_parse_args( $atts, $defaults ); $html = ''; $search = array( '%relation%', '%name%', '%separator%' ); if ( $relations = $entry->getFamilyMembers() ) { // Grab an instance of the Connections object. $instance = Connections_Directory(); foreach ( $relations as $relationData ) { $relation = new cnOutput(); $replace = array(); if ( $relation->set( $relationData['entry_id'] ) ) { $replace[] = $instance->options->getFamilyRelation( $relationData['relation'] ); $replace[] = cnURL::permalink( array( 'type' => 'name', 'slug' => $relation->getSlug(), 'title' => $relation->getName( array( 'format' => $atts['name_format'] ) ), 'text' => $relation->getName( array( 'format' => $atts['name_format'] ) ), 'home_id' => $entry->directoryHome['page_id'], 'force_home' => $entry->directoryHome['force_home'], 'return' => TRUE, ) ); $replace[] = empty( $atts['separator'] ) ? '' : '<span class="cn-separator">' . $atts['separator'] . '</span>'; $row = str_ireplace( $search, $replace, empty( $atts['item_format'] ) ? $defaults['item_format'] : $atts['item_format'] ); $html .= "\t" . sprintf( $row, $atts['item_tag'] ) . PHP_EOL; } if ( $atts['show_phone_numbers'] ) { $html .= $relation->getPhoneNumberBlock( array( 'format' => $atts['phone_format'], 'type' => $atts['phone_types'], 'return' => TRUE ) ); } if ( $atts['show_email'] ) { $html .= $relation->getEmailAddressBlock( array( 'format' => $atts['email_format'], 'type' => $atts['email_types'], 'return' => TRUE ) ); } if ( $atts['show_dates'] ) { $html .= $relation->getDateBlock( array( 'format' => $atts['date_format'], 'type' => $atts['date_types'], 'return' => TRUE ) ); } } $html = sprintf( '<%1$s class="cn-relations">' . PHP_EOL . '%2$s</%1$s>', $atts['container_tag'], $html ); $html = $atts['before'] . $html . $atts['after'] . PHP_EOL; } echo $html; }08/01/2016 at 10:22 pm #385127wemmons53
ParticipantWorks thanks. Now just need to get the lines formatted they way we need them.
08/02/2016 at 8:37 am #385163Steven Zahm
Keymaster@ William
Great, do you see the minor changes that were needed to get it working?
-
This reply was modified 10 years ago by
-
AuthorPosts
- You must be logged in to reply to this topic.
