Skip Navigation

[Resolved] is_archive() No Longer Appears to Work within Conditional Arguments

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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 9 replies, has 3 voices.

Last updated by zacharyL 5 months, 3 weeks ago.

Assigned support staff: Waqar.

Author
Posts
#2370223
Screenshot 2022-05-24 at 15-48-09 You searched for aegis AG Aegis Company Inc.png

For awhile we've been using the following conditional argument

[wpv-conditional if="( is_archive() ne '1' )"]

to hide our sites' breadcrumbs from the excerpts seen in the search archives. This being a solution we've come across from your support forums, it has worked well for us while we were using the legacy Toolset legacy plugins.

That said, we've recently converted our development stack to the current Toolset model that no longer utilizes the legacy plugins, so we're still finding areas where we can improve and areas that quite work as well as they used to. One of these areas is the use of the is_archive argument.

You can see the page where this is an issue here: hidden link

Please see attached to see what I'm talking about.

For context, our pages are built out using Divi, so the breadcrumbs are baked into the body content of each page and post that needs them. Using a Toolset conditional argument has been our means of keeping the breadcrumbs from showing up in post excerpts seen in the archives. However, since the breadcrumbs are now showing up in the post excerpts, it creates a reading issue and is confusing to the user, especially since the output doesn't even pertain to the specific page it's embedded from within the post loop output. And yes, the function is configured in the "Functions inside conditional evaluations" section in the Toolset Settings.

It's quite possible this stopped working a long time ago, and now I'm now just noticing it, but any help in this matter would be greatly appreciated.

#2370551

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

Hello,

I can login into your website, please provide more details for the problem.
Where did you put the shortcodes?

[wpv-conditional if="( is_archive() ne '1' )"]

I have checked the Toolset WordPress Archive:
hidden link
But did not find above shortcode.

#2374575
screenshot-2.png
screenshot.png

You won't find them on the search archives, as the conditional argument is embedded directly onto the content pages on the site (ie. About Us, Services, Industries). Please see attachment screenshot.png

Because whatever you build into a Divi page exists within the post body, it gets output into the excerpt, though previously this conditional argument worked to keep the breadcrumbs out of the post excerpt in the loop output.

The conditional argument still currently works on sites we've developed using Toolset's Legacy plugins. Please see attachment screenshot-2.png (hidden link), which uses this conditional argument in the same kind of application (wrapping around breadcrumbs).

#2374847

Luo Yang
Supporter

Languages: English (English ) Chinese (Simplified) (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

As I mentioned above, I need detail step to reproduce the same problem:
Where did you put the shortcodes?

[wpv-conditional if="( is_archive() ne '1' )"]

Please point out the URLs, I need to test and debug those codes.

#2375505

My apologies. The following pages have the conditional logic wrapping their breadcrumbs:

  • hidden link;
  • hidden link;
  • hidden link;
  • hidden link;
  • hidden link;
  • hidden link;

As I explained above, and illustrated in my screenshots, I put the conditional shortcodes into the Divi built pages. You will find them in modules labeled "Breadcrumbs [Shortcodes]".

#2376959

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Luo is on vacation so I'll be following up on this ticket.

I'm currently performing some tests on my website, with a similar setup and will share the results, as soon as this testing completes.

Thank you for your patience.

regards,
Waqar

#2377357

Great, thank you. I appreciate it. I will be going on vacation as well, so it may be a week or so before I can respond back to this thread.

#2379305

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Have a nice vacation and I'll be able to share my findings, by the end of the day today.

#2380111

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thank you for waiting and here are my findings.

The conditional check that you're using checks for archives (is_archive), but not for the search results page ( e.g. {yourwebsite.com}/?s=aegis&wpv_view_count=753 ).


[wpv-conditional if="( is_archive() ne '1' )"]
		[yoast-breadcrumbs]
[/wpv-conditional]

To extend this condition to also cover the search results page, you can include the "is_search" function joined with the 'AND' operator:
( ref: https://developer.wordpress.org/reference/functions/is_search/ )


[wpv-conditional if="( is_archive() ne '1' ) AND ( is_search() ne '1' )"]
		[yoast-breadcrumbs]
[/wpv-conditional]

Note: please add "is_search" in the "Functions inside conditional evaluations" section, at WP Admin -> Toolset -> Settings -> Front-end Content.

After that, the breadcrumb text will be excluded from the search results page too.

#2384937

Great! It appears to be working now. Thank you so much for your assistance!