Skip Navigation

[Resolved] Archives and full width containers

This support ticket is created 3 years, 5 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by beingk 3 years, 5 months ago.

Assisted by: Shane.

Author
Posts
#2108415

I'm struggling with the Archives as I need to add additional full width containers and even other Views. The WordPress Archive loop for each respective CPT is fine, but it doesn't seem to be possible to add containers outside of that loop. Is there a workaround for that? I've tried custom CSS for the containers with position: absolute, but that really messes up the layout.

I'm creating pages with Views as a workaround, however, I can't use the slug for the CPT and I end up having different URLs, which is not ideal. I would prefer to have website.com/cpt-slug/title (Single) and website.com/cpt-slug (Archive), instead of website.com/page-slug.

#2108501

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2021-07-07 at 9.45.45 AM.png

Hello,

Thank you for getting in touch.

but it doesn't seem to be possible to add containers outside of that loop. Is there a workaround for that?

Yes this is possible to do as there is an add button below the loop to add any block that you want. See Screenshot

I'm creating pages with Views as a workaround, however, I can't use the slug for the CPT and I end up having different URLs, which is not ideal. I would prefer to have website.com/cpt-slug/title (Single) and website.com/cpt-slug (Archive), instead of website.com/page-slug.

Can you provide a bit more detail on this for me.

Thanks,
Shane

#2109265

Hi. I realized adding containers outside of the loop is possible, but they are still part of the Archive in the hierarchy and even when specified as full width, they are contained. When using a layout without sidebars, the workaround to make that container full width is the following:

.row-full{
   width: 100vw;
   margin-left: calc(-50vw + 50% - 9px);
   position: relative;
}

As for the second point, let's say all my WP Posts are displayed at website.com/blog. I can use Toolset to edit the Archive, but it's limited to a single View/Loop, which has limited options, like a lack of offsetting posts (I've resorted to hiding with ':first-child' CSS property). In my case, I need to show the latest post at the very top in a Hero area, followed by a list of the rest of the posts with pagination. I haven't been able to handle this in an archive, as to my knowledge I can't have a separate view for the Hero area. I can, however, create a page and insert the views, with proper styling and offsetting. The issue is that the page can't have the needed website.com/blog URL, as that is reserved for the Archive.

I also tried the approach for a CPT (let's say slug 'press-releases') and disabled Archives for the CPT. Then I was in fact able to create a page and use the website.com/press-releases URL, which normally would have been reserved for the Archive. But then when I tried to edit the properties for the Press Releases CPT I was unable to make any changes, since the 'press-releases' slug was already taken by the page I created. So obviously this wasn't a great idea in the first place.

I guess my question is: am I getting any of this wrong or is it the expected behavior? I'm not expecting Toolset to handle every possible user case, but I thought that my particular need was fairly straightforward.

Thank you for your time.

#2109333

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hello,

But then when I tried to edit the properties for the Press Releases CPT I was unable to make any changes, since the 'press-releases' slug was already taken by the page I created. So obviously this wasn't a great idea in the first place.

Are you trying to edit the post on the frontend or on the backend ? The disabling of the archive would've been the best solution which you have already done.

The only other solution is to change the slug and using the redirection plugin you can redirect from the original slug to the page with the view.

Please provide some clarity on the editing issue and perhaps a screenshot so that i can better understand this.

Thanks,
Shane

#2109335
Screenshot 2021-07-08 072856.png

Thanks for clarifying, Shane. It sounds like I'm not doing anything wrong.

I wasn't trying to edit a particular post. I was editing the CPT in the back end, where the slug is defined.

In most cases the Archive loop is sufficient to display a list of CPTs. In case I need something fancier I'll disable Archive and redirect the CPT slug to the page.

In case anyone is interested in a solution for the Blog (which I really wanted to preserve as /blog), I used GeneratePress Page Hero element with dynamic content, which pulled the current Post and in the case of Archive page, that post was exactly what I needed - the most recent post. The only caveat was the Title being pulled was of the Archive and not the post. Below is the shortcode I ended up using. Also, the offset the 1st post from the list, I used CSS display:none for first-child in the list. Picture attached.

add_shortcode('latest-post-title-w-link',function(){
    return sprintf(
        '<a href="%1$s">%2$s</a>',
        get_permalink(),
        get_the_title(),
    );
});
#2109345

My issue is resolved now. Thank you!