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 5 replies, 3 voices, and was last updated 11 years, 1 month ago by
Steven Zahm.
-
AuthorPosts
-
06/27/2015 at 3:56 am #338799
Brian McClendon
ParticipantBy default, the card displays the name and title in the overlay. I wonder if I can add the parent (and possibly child) category to the overlay, before the name. Is this straightforward?
06/30/2015 at 9:55 am #339083Steven Zahm
Keymaster@ Brian
This is possible but requires that you edit the
card.phpfile found here:../wp-content/plugins/connections-gridder/Add this line of code where you want the categories to be shown:
<?php $entry->getCategoryBlock( array( 'separator' => ', ', 'before' => '<span>', 'after' => '</span>' ) ); ?>Rather than overwrite the existing
card.phpfile, you should follow the advice in this QuickTip so your change is not lost if the the template is updated.07/01/2015 at 2:09 am #339234Brian McClendon
ParticipantThanks for the reply, Steven, but the code is not working; I’m sure I’m not applying it correctly. I’m using the format from demo 1 on this page, with the static overlay. I’d like the subcategory (e.g., category = animal, subcategory = dog) to print above the name, for example line 1: “dog”; line 2: NAME; line 3: title. Therefore, I pasted it on line 43 of card.php, but to no avail. Any suggestions would be appreciated. Thanks.
07/01/2015 at 8:52 am #339270Steven Zahm
Keymaster@ Brian
Line 43 should be the correct line to paste the code on to get it to display above the name. Pasting it on that line you would not need the opening and closing php tags though, just this:
$entry->getCategoryBlock( array( 'separator' => ', ', 'before' => '<span>', 'after' => '</span>' ) );Id did forget about the CSS you would need… you need to define the size and line height otherwise it will not show.
#cn-gridder .cn_category_label, #cn-gridder .cn_category { line-height: 18px; font-size: 16px; font-weight: normal; }Hope that helps.
07/01/2015 at 4:45 pm #339304Brian McClendon
ParticipantThat works. Thanks! If you have time for one more related question: I have two types of people, faculty and grad students, and two categories for each, nested under a parent category (e.g., parent: faculty; children: core, affiliate). For faculty, I’m merging the parent with the child minus the separator, yielding “core (child) faculty (parent)”. For grad students, I’d like to only display the parent. I think this will require an if parent === id, print parent, but I’m not sure how to do it. I think this page provides a clue, but if it’s straightforward, and if you have time, I’d appreciate one more bit of help. Thanks.
07/02/2015 at 8:44 am #339334Steven Zahm
Keymaster@ Brian
Yes would need to do something similar to the link you shared but I think I would add it to the
card.phpfile rather than implement a whole new plugin.Rather than using the
$entry->getCategoryBlock()method you have to work with the$entry->getCategory()method. That’ll return the category data rather display it.Then you would do something like this:
foreach ( $entry->getCategory() as $category ) { if ( $category->parent == 2 ){ array_push( $faculty, $category ); elseif ( $category->term_id == 11 ) { $student = $category; } foreach ( $faculty as $person ) { echo 'Faculty (' . esc_html( $person->name ) . ')'; } if ( isset( $student ) ) { echo esc_html( $student->name ); }Hope that get you on your way!
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.
