Site logo

Archived topic

Issue with with Element Display Rules

28 replies · Started by Fabien on May 16, 2022

Viewing posts 16–29 of 29

Then it makes it impossible to select in Display Rules. I believe this should be fixed ;-)

Hi there,

Just to confirm:

1. The post type does not have archives you can view on the frontend
2. The taxonomy (attached to that post type) does have archives you can view on the frontend
3. The post type does not show in Display Rules
4. The taxonomy does not show in Display Rules

Is that correct?

Thanks!

Hi @Tom,

Sorry just saw your reply now.

Find my answers below :

1. The post type does not have archives you can view on the frontend

True

2. The taxonomy (attached to that post type) does have archives you can view on the frontend

True, terms archives

3. The post type does not show in Display Rules

The post type (single view) shows in Display Rules. Which is a "normal" behaviour, then you can target the single template, but not the archive template (again, all normal here).

4. The taxonomy does not show in Display Rules

Here comes the issue. When the CPT archive is set to false, in display rules, you only have the option to select taxonomy terms 1 by 1. Example 1 in private information.

In order to target all terms, you need to have the CPT archive set to true. Example 2 in private info

To summarize: CPT archive (true or false) shouldn't impact taxonomy archive. But it does.

Hope it's clear.

Hi @Tom,

Any news on this ?

Thanks

Hi there,

Tom is out the office today and tomorrow. I can see its on his issues list, so he we will able to review early next week.
Sorry for the delay

No worries. Thanks @David !

Thanks for your patience and understanding :)

Hi @David / @Tom,

Following up on this, any news ?

Sorry for the delay here - had a couple weeks of vacation.

We're about to start reviewing the last needed tweaks/fixes for GPP 2.2.0, and I'll make sure this issue is reviewed and fixed if possible. Certainly seems like a bug, but I'll need to dig in a bit to confirm.

Will update this thread once I have more information.

Thanks!

Hi there,

Been playing with this trying to find a solution for 2.2.0.

The current functionality is intended - it works this way with all other post types as well.

In order to display an Element within an archive (showing all posts with a specific taxonomy term), the post type needs an archive. This is just the way the Display Rules feature has its logic, unfortunately. We could remove that check, but it will introduce a whole new set of bugs/inconsistencies.

One alternative is to set has_archive to true and just 301 redirect the actual archive pages.

I'm going to leave this open in our private GitHub in case we can figure out some sort of solution. Perhaps a way to filter in post type names to allow even if they don't have an archive. Something like this:

add_filter( 'generate_elements_allowed_archives', function( $archives ) {
    $archives[] = 'your-post-type';

    return $archives;
} );

Hi @Tom,

Any news on this ?

Again what I am trying to target is a taxonomy archive page where the post type attached to this taxonomy has_archive is false.

It is defintaly feasible (without custom code) with Beaver Builder / Themer for example. I don't see why it wouldn't be possible with GP/GB. Having a custom tax attached to a CPT without archive is not a "specific" case.

Happy to discuss live / show you the example with BB.

Thanks,

Fabien

Any news ?

Hi there,

No update on this, unfortunately. I'd like to fix it without any code, but we're unable to do that without possible breakages, which is why we've stalled on a solution.

I've milestoned this for 2.4.0 (as we're able to release 2.3.0 on Tuesday).

We'll release a (hopefully no-code-needed) solution in that version.

Thanks for your patience!

Ok, great. Thanks @Tom, looking forward to the release.

Fabien

This archived topic is closed to new replies.