I have an archive for a CPT that doesn't show the translated page if there's no post. It works fine of there's a post, but as soon as I make it a draft, the page dissapears from translations. I saw in a similar forum question that if no posts, there no archive, but in my case, there is content on the archive page, this content is translated correctly, please help.
What do you mean with "there's content on the archive page"? If the page is just a template, not a *real* page, even if there is something like the description it's correct not seeing it.
Unless you have a page called archive or something like that this is the expected behavior
An archive page can have other content than just posts, and the other content is important here. The CPT is jobs, the archive page is the send us your resume / here are job openings, so if there's no openings, the form still needs to be accessible (on the archive).
I understand your requirements. If the Archive page that you're referring to is a template and you've translated the template properly from WPML > Translation Management, then you should be able to access the Archive template in the frontend. But, to assist you better, could you kindly share how you have created the CPT and rendering the archive in the frontend? I'll check based on that and try my best to assist you in this matter.
So, first of all, it's an Elementor website using templates as archives. The CPT is managed with CPT UI, and it is set to translatable (in the post types in WPML) I checked if there were any strings not translated related to that archive and couldn't find any (with string translations).
I have translated the archive template, and I made a "test" post, which I translated too. Everything works fine when there's a post, but if I delete the post (no posts to show) then the language switcher dissapears (the 'connexion' between the french and english archives is lost), but the archive remains available and I can get to it from the english menu without any problem, the problem is when switching from english to french from the lang selector on that page only, if I click it while no job posts are published (no jobs offerings at the moment), it brings me to home page instead of seeing the translated archive.
Right now, I'm "cheating" the system to make it work, I made a post with my text 'no jobs available at the moment' and I'm serving that as alternate template, that way I always have a post. But I don't want this to stay like that, it's not the way it should be and I need it to be fixed.
Hi There,
Thank you for nicely clarifying everything!
Let me inform you that in WordPress, there is a general behavior where an archive page (be it for categories, tags, custom post types, or any other taxonomy) is typically only displayed if there are posts associated with it. This means that if an archive (like a category archive) doesn't contain any posts, WordPress usually doesn't display the archive template and may instead show a 404 Not Found page or a message indicating that no posts are available.
How a post-type archive will be displayed in the frontend is entirely handled in the core of WordPress. WPML's role is limited in this aspect; it can provide translations for the post type and its archive template, but it cannot alter the fundamental way WordPress handles the presentation of post-type archives. Essentially, WPML adds language support but doesn't change the underlying behavior of WordPress regarding archive display. I hope you can understand.
To make an archive page appear in other languages even when there are no posts, additional custom coding is required which falls beyond the scope of our support. But, I will try my best to help in this matter by providing suggestions and guidance.
They are specialized in customizing WPML and I hope they can help you in this matter.
I hope you can understand. If there is anything else I can help you with, please let me know. I will be happy to help.
Best regards,
Prosenjit
The topic ‘[Closed] CPT archive not showing if no posts’ is closed to new replies.
Manage Cookie Consent
We use cookies to optimize our website and services. Your consent allows us to process data such as browsing behavior. Not consenting may affect some features.
Functional
Always active
Required for our website to operate and communicate correctly.
Preferences
The technical storage or access is necessary for the legitimate purpose of storing preferences that are not requested by the subscriber or user.
Statistics
We use these to analyze the statistics of our site. Collected information is completely anonymous.The technical storage or access that is used exclusively for anonymous statistical purposes. Without a subpoena, voluntary compliance on the part of your Internet Service Provider, or additional records from a third party, information stored or retrieved for this purpose alone cannot usually be used to identify you.
Marketing
These cookies track your browsing to provide ads relevant to you.