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 3 replies, 2 voices, and was last updated 6 years, 1 month ago by
Trevor Wilcox.
-
AuthorPosts
-
08/16/2017 at 6:43 pm #432535
Trevor Wilcox
ParticipantHi Steve
I don’t think this is something I can do with Connections “out of the box”, but was wondering if there was a way to conditionally test at the individual entry level for a specific category to elicit a certain behavior? For example, I have some Senior Management who have their own category and are all shown first in the general listing… they have their profile pictures shown while other staff, who follow in the listing by ascending order of surname, do not, unless the user is logged in (my site is a membership site). Senior Managers are also interspersed into other categories beyond the Senior Management category however, and when a search is performed (outputted to a different results page using the home_id), their photos are not shown by virtue of the parameters of the shortcode in the results page. My thinking is that if I’m able to conditionally test for the Senior Management category at the template level, then I might be able to get around this.
Appreciate your advice.
08/16/2017 at 6:54 pm #432536Trevor Wilcox
ParticipantIt’s 6am here so please excuse any gaps in train of thought :) but here is the rough logic how I envision it could work, and thus even within one shortcode instance I could control if a picture is shown based on the individual entry’s category:
if (cn_show_image = true) {
if (user is logged in) {
show_image
}
} else {
if (cn_category = senior_management) {
show_image
} else {
do not show image
}
}-
This reply was modified 6 years, 1 month ago by
Trevor Wilcox.
08/17/2017 at 11:09 am #432627Steven Zahm
Keymaster@ Trevor
Sure this is doable you would add something like this to the
card.php
andcard-single.php
files for the template.Something like this:
$categories = array(); foreach ( $entry->getCategory() as $category ) { $categories[ $category->slug ] = $category->name; } if ( true == $atts['show_image'] ) { if ( is_user_logged_in() ) { // code to display image } } else { if ( array_key_exists( 'senior-management', $categories ) ) { // code to display image } else { // I do not think you need this else since it does not do anything. } }
Hope this helps!
08/17/2017 at 8:17 pm #432665Trevor Wilcox
ParticipantPerfect! Thank you!
-
This reply was modified 6 years, 1 month ago by
-
AuthorPosts
You cannot reply to this support topic. Please open your own support topic.