Archived topic
change content of archive custom post type
25 replies · Started by David on April 8, 2019
Hello
I've set up a new custom post type called team.
I've then created a archive-team.php page and put that in the child theme - I'm then looking at changing the layout of the archive team page so have copied over the content page and renamed it content-team.php and put in to child theme folder.
When I make any changes to the content-team.php page though, nothing changes!
http://185.20.51.60/~skyworldco/team/
Please help.
Thanks
Dave
Hi there,
In your archive-team.php file, replace this line: https://github.com/tomusborne/generatepress/blob/2.2.2/archive.php#L42
With this:
get_template_part( 'content', 'team' );
Let me know if that helps or not :)
Great, thanks - how can I get the team custom posts to show in descending order?
Thanks
Dave
You could try something like this:
add_action( 'pre_get_posts', function( $query ) {
if ( $query->is_main_query() && ! is_admin() ) {
if ( $query->is_post_type_archive( 'team' ) ) {
$query->set( 'order', 'DESC' );
}
}
} );
Thanks Tom
Hi Tom
What file would I need to copy across to edit this page...
http://185.20.51.60/~skyworldco/team/chris-beer/
I've sorted the archive page http://185.20.51.60/~skyworldco/team/chris-beer/
Thanks
Dave
That's the single.php file :)
So how would I go about making this appear in 2 columns? so the featured image is to the left?
I can't see the code for this in single.php
The featured image is hooked into the template, so you would have to disable the featured image and then add it manually to the template.
What kind of layout are you going for? Any examples of what you want vs what you have?
Trying to create this...
Haven't thought about how to do the pop up yet, just trying to get the layout of the team member correct.
Thanks
Dave
And what do you have so far? Will you end up adding it as a popup?
I have this so far...
http://185.20.51.60/~skyworldco/team/chris-beer/
Yes the aim is to get it to open in a pop up once I've got the layout sorted
Thanks
Dave
You could try this CSS:
.single-team .featured-image {
float: left;
max-width: 50%;
margin-right: 2em;
}
.single-team .entry-content {
overflow: hidden;
}
Hi Tom
How do I add this class... class="modal-link iframe" to the href tag on the images of the archive for my team page...
http://185.20.51.60/~skyworldco/team/
Thanks
Dave
How are you adding those images? the_post_thumbnail()?