In my tutorial requests Trello board, a user asked:
I would love a tutorial on how to use cpt and maybe the accordian show/hide to get a result similar to this Team/Staff page: http://www.unified.com/team/ I think this could be used for portfolio pages also. Thank you so much!
I think this could be used for portfolios and other uses as well. Thank you!
In this article, we are going to set up a Team CPT archive page displaying a grid of team members' photos. Hovering on a team member's photo will display name and job title (a custom field) of the person on a random background color overlay. Clicking on the photo will slide down an info panel showing more info about that person incl. social icons (if their URLs have been entered in the back end).
We shall use CSS filter to make the photos black and white in regular state and in color when the info panel is open for a member.
Screenshots:
Team CPT archive:
When a photo is hovered:
After a photo is clicked:
Screencast:
Step 1
Install and activate Pods.
Create a Team Member CPT with support for Featured image and enable archive page. Under Advanced Options specify team
for Archive Page Slug Override.
Add these custom fields: Job Title, Twitter, Facebook and Linkedin.
You might want to make the Job Title mandatory.
If you wish, you can import the above into Pods using this code (mirror).
Step 2
Add the following in child theme's functions.php:
// Register a custom image size for Team images
add_image_size( 'team', 250, 250, true );
// Make Font Awesome available
add_action( 'wp_enqueue_scripts', 'enqueue_font_awesome' );
function enqueue_font_awesome() {
wp_enqueue_style( 'font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css' );
}
Step 3
Add team members. Remember to upload/select featured images (250px x 250px is the ideal size) and fill in the custom fields.
Regenerate thumbnails, if necessary.
Step 4
Create a file named say, team.js in the child theme's js
directory having this code:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
A+ as always.
Great tutorial! Could we create a CPT via function file and use ACF instead?
Thanks
Yes.
Can’t wait to dig into this! Thank you!
A+++ . Can’t wait to have a chance to implement.
Thanks, Sridhar!
Thank you for the great tutorial. It seems that everyone wants a grid of team photos these days. I love how the info is available on the page, rather than sending the user to a separate bio page. Very nice.
Another frequently requested function is to have the team photos in a sort-able grid. This functionality combined with a sort-able grid would be heaven. I can see so many uses for it from a project portfolio to items on a small e-commerce site. A future tutorial perhaps?
Do you have an example site or a mockup image of how this should look like?
I’ll do a mockup image tomorrow and post a link.
Here is a link to a mockup https://www.dropbox.com/s/xawcwo9bw5tvl0e/Sortable-Porfoliio-Wishlist.jpg?dl=0
Thank you for taking the time to look at this.
Excellent! Is it possible to divide the team archive using categories? Just like the http://www.unified.com/team version where there is a section for Leadership and for Board of Directors.
Hi! Thanks so much! This is what I was looking for. I have two issues implementing it. First one is that when I click over an image the accordion opens but it does not show the information on the entire container width, it cuts the info at the image width. Also the grid only shows three images and then the pagination…. Any help would be deeply appreciated… The site is in develop stage so I have recorded a 10 secs. video so you can see what is happening. https://vimeo.com/193041069/283cba74eb
Just in case is important I’m using Gallery Pro theme. Thanks!
What about implementing using Types instead of Pods?
Did you try this? I want to use Types as well
Heh Sridhar- I’ve implemented a working version of GridTab on one screen test: http://www.lamfers.com/2016-test/why-la/team-2/
and now have tried to implement the above solution here: http://www.lamfers.com/2016-test/team
But I cannot seem to call the grid, at all. How do I address this archive? And which Advanced Options should be checked for the Team pod?
Thanks a lot. I’d really prefer to use this version if I could get it to work.
I changed the name of the php file to ‘archive-team.php’ so I can now sort of see a grid, but it is repeating the image files, and in addition there is only one text rollover being shown, and not for the correct image. I’ve only put in 1 coloured image.
Thanks for any help!
-e.
Has the CSS code from the tutorial been added?
I searched for
.team-overlay {
, for example in your child theme’s style.css and couldn’t find it.Yes, it’s there.
I have just implemented this tutorial in my test site with Executive Pro 3.2.2 and it’s working fine.
These additional changes are recommended:
1) In
functions.php
a) comment out or delete
add_action( 'genesis_entry_header', 'genesis_post_info', 5 );
b) add
2) In
style.css
, addIf it helps, I can make my Executive Pro test site live and give you WP login, so you can take a look inside. Let me know.
Sridhar- So, now it is sort of working, but there are still a small and large image, and no mouseovers. Since we would really prefer this solution I’m going to reverse out everything I did for the other solution and see if I can get further with this. I think part of the issue might come from the advanced settings in the plugin. So, yeah, it would be great to have access to see what you did there.
You can see it in action here: http://rohnermail.wpdemos.co/team/
Please contact me via https://sridharkatakam.com/contact/ with a URL of this post/comment so I can reply with the WP login.
Thank you SO MUCH for your help Sridhar. I was able to get it working correctly with a few edits after seeing what you had done. In the pods admin you labeled them Team Member and Team Members, I had labeled them only Team. Perhaps you could add that to your tutorial? Also, I found a second instance of
remove_action( 'genesis_entry_content', 'genesis_do_post_image', 8 );
in my theme’s function file which created the 2nd image.
I’m still working out the css details but it looks and works well here:
http://www.lamfers.com/2016-test/why-la/team/
I’d like to add a header above the archive loop but I cannot see a way to do this. I’ve added it into ‘genesis_before_loop’ but it still reads as part of the grid. Any ideas?
Have you tried other hooks like
genesis_before_content
orgenesis_before_content_sidebar_wrap
orgenesis_after_header
?Yep, I got it to work nicely, used ‘genesis_before_content’.
I’m still working on the responsive css.
Thank you so much for your help, they’re going to love it!
I just have to say that I have now successfully implemented this for a second client and they LOVE it! Thank you so much for your help. I’m so glad I could recreate it with a different design/css/layout.
I ran into a small issue with this tutorial. I’m using metro pro and when I have the breadcrumbs on things go out of alignment.
-Scot
Hi,
I have followed your tutorial but the team members are not styled. You make mention to the pod template, but I’m unsure how to pull in style.css into the pod template. I’ve never used pods before and am finding this a bit of an uphill strugglle
Any chance of some more detail around how the Pods template should be detailed?
Thanks
Colinz
Hi All,
Having read through the comments above I am unsure if anyone has got this tutorial to work so I’m reaching out here. Can anyone point me in the right direction with a copy/pasting what they have put into their Pods template of their working version? If so I will be a) eternally grateful and b) proved wrong!
Thanks in advance
Colinz
Hi Colin,
We are not using any Pods template for this tutorial. I use Pods only for creating and managing CPTs and custom taxonomies and in some cases (like here), creating a few custom fields.
All styling is via CSS code.
Can you provide the URL of your site?
Okay, as I said before, I have now successfully implemented this twice. THANK YOU!
One is live:
http://www.lamfers.com/why-la/team/
The second is still in development. My only issue now is that I’d like one Pod field for ’email’ address and yet I can’t get it to read, or display. Any ideas? I created the field type email (they call it: E-mail). I tried swapping ‘linkedin’ to ’email’. Do you have any ideas? I’m pretty new to Pods. Here’s the edited code in my archive-team_member.php
// get custom fields
$twitter = esc_url( get_post_meta( get_the_ID(), 'twitter', true ) );
$facebook = esc_url( get_post_meta( get_the_ID(), 'facebook', true ) );
$email = esc_url( get_post_meta( get_the_ID(), 'email', true ) ); ?>
<a href="javascript:void(0)" class="js-accordion-trigger">
<img src="<?php echo genesis_get_image( 'format=url&size=team' ); ?>" alt="<?php the_title(); ?>">
<span class="team-overlay">
</span>
</a>
Close
<?php if ( $twitter || $facebook || $email ) { ?>
">
">
">
Okay, I went and looked into fonta wesome to see which icon I actually wanted and there is NO ’email’ icon, so I changed the code to:
<a class="email-team" href="”>
so I could call the @ for email. The reality is I still need it to call the address that is in the field but it is calling a web address. Any ideas? This is stumping me. If worse comes to worse I’ll just add the link to the text field.
Make sure the actual internal name of your email field is actually
email
.For the code to appear in full, you need to wrap them in three backticks or alternately, paste at pastebin.com and share the link.
The email field name ‘is’ email, but the field type is E-mail (what Pods calls it.)
Here’s my code:
// Display grid content
add_action( ‘genesis_entry_content’, ‘sk_do_post_content’ );
function sk_do_post_content() {
// get custom fields
$twitter = esc_url( get_post_meta( get_the_ID(), 'twitter', true ) );
$facebook = esc_url( get_post_meta( get_the_ID(), 'facebook', true ) );
$email = esc_url( get_post_meta( get_the_ID(), 'email', true ) ); ?>
<a href="javascript:void(0)" class="js-accordion-trigger">
<img src="<?php echo genesis_get_image( 'format=url&size=team' ); ?>" alt="<?php the_title(); ?>">
<span class="team-overlay">
</span>
</a>
Close
<?php if ( $twitter || $facebook || $email ) { ?>
">
">
">
<?php } ?>
</div>
<?php }
“>
“>
“>
I can take a look inside and try to troubleshoot if you want.
Send me the WP and FTP/cPanel logins along with a URL of this page via https://sridharkatakam.com/contact/.
Thank you for the offer Sridhar-
I decided to simply add the code into the bio. It looks fine.