[Resolved] change content of archive custom post type

Home Forums Support [Resolved] change content of archive custom post type

Home Forums Support change content of archive custom post type

Viewing 15 posts - 1 through 15 (of 26 total)
  • Author
    Posts
  • #862611
    David

    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

    #863032
    Tom
    Lead Developer
    Lead Developer

    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 ๐Ÿ™‚

    #863039
    David

    Great, thanks – how can I get the team custom posts to show in descending order?

    Thanks
    Dave

    #863358
    Tom
    Lead Developer
    Lead Developer

    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' ); 
            }       
        }
    } );
    #863549
    David

    Thanks Tom

    #863826
    David

    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

    #864176
    Tom
    Lead Developer
    Lead Developer

    That’s the single.php file ๐Ÿ™‚

    #864234
    David

    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

    #864470
    Tom
    Lead Developer
    Lead Developer

    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?

    #864641
    David

    Trying to create this…

    https://ibb.co/HGXRNVz

    Haven’t thought about how to do the pop up yet, just trying to get the layout of the team member correct.

    Thanks
    Dave

    #865277
    Tom
    Lead Developer
    Lead Developer

    And what do you have so far? Will you end up adding it as a popup?

    #865302
    David

    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

    #865498
    Tom
    Lead Developer
    Lead Developer

    You could try this CSS:

    .single-team .featured-image {
        float: left;
        max-width: 50%;
        margin-right: 2em;
    }
    
    .single-team .entry-content {
        overflow: hidden;
    }
    #870586
    David

    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

    #870949
    Tom
    Lead Developer
    Lead Developer

    How are you adding those images? the_post_thumbnail()?

Viewing 15 posts - 1 through 15 (of 26 total)
  • You must be logged in to reply to this topic.