Skip Navigation

[Gelöst] posts repeated twice on taxonomy archive

This support ticket is created vor 4 Jahre, 4 Monate. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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/Hong_Kong (GMT+08:00)

This topic contains 6 Antworten, has 2 Stimmen.

Last updated by guyA-2 vor 4 Jahre, 4 Monate.

Assisted by: Luo Yang.

Author
Artikel
#1402101

Hi there,

I have two taxonomy archives built out in the same way:
event categories
hidden link
and event teachers
hidden link
For some reason the posts are being repeated on the taxonomy archive for event-teachers.

Can you help us work out why this is happening?

#1402471

Hello,

The URLs you mentioned above are taxonomy archive pages, so it is recommended to use Views WordPress Archive to customize WordPress archive page.

And you are using custom codes in your theme file "archive.php", line 11~44:

 <?php if (is_tax( 'event-teacher' )) {
 ...
      echo render_view( $args );
  }?>

It will conduct unexpected results.

I suggest you try these:
1) Create copy theme file "category.php" and save it as taxonomy-event-teacher.php
https://developer.wordpress.org/themes/basics/template-hierarchy/#custom-taxonomies

2) Follow our document to setup WordPress Archive for taxonomy "event-teacher", and test again:
https://toolset.com/documentation/user-guides/creating-wordpress-custom-post-archives/

#1402717

Hi Luo,

Thanks for your support. I've now created an custom post archive in Toolset and the filtering is working.
There are two new issues that I now need your help with:

1. How do we dislpay the h1 as Events on the events archive and then change it to show Event Category: [category-title] and Event Teacher: [teacher-title]

2. We've now lost our sidebar which is set up under Appearance Widgets. How do we get the sidebar displaying from within the Toolset custom post archive.

Thanks for your help so far!

Guy

#1403517

Q1) You can try this:
Event Teacher: [wpv-taxonomy-archive info="name"]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive
This shortcode displays information about the current taxonomy

Q2) This is defined by your theme file "archive.php", you can display the sidebar with WordPress function get_sidebar(), for example, edit theme file "archive.php", replace the codes as below:

<?php get_header();
if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; endif;
?>
<?php get_sidebar(); ?>
<?PHP
get_footer(); ?>

More help:
http://codex.wordpress.org/Function_Reference/get_sidebar
Load sidebar template.

#1403863

Hi Luo,

I've implemented point 1 now but need a little more assistance.
In Toolset I'm currently using one archive for both the event archive and the two event taxonomies (teachers and categories).

Point 1
[wpv-taxonomy-archive info="name"] works on the two archive pages but I I need to use something else for the archive.
Is it possible to use the same archive for events and the taxonomies using some conditional logic?
For example:
If archive=events show Events
if taxonomy=event-categories show: Event Catogory: [wpv-taxonomy-archive info="name"]
if taxonomy=event-teacher show: Event Teacher: [wpv-taxonomy-archive info="name"]

Point 2
On point two I'm a bit confused... aren't we using the archives in Toolset now, so surely this overriding archive.php template file?

Another issue
Finally I've got a custom breadrumb shortcode that I've dropped into the archive but when I view source it's actually rendering the php For example I see: <?php echo do_shortcode("[wildheart-breadcrumbs]"); ?> How do I get this to actually render the shortcode?

Thanks for your help so far!

#1403893

Q1) Yes, it is possible with [wpv-conditional] shortcode, for example, this thread:
https://toolset.com/forums/topic/if-a-specific-category/

But in your case, I suggest you setup different WordPress Archive for each taxonomy, then you will be able to customize each taxonomy archive page differently and easily.

Q2) Views WordPress archive takes effect on the archive page content area, in your case, it is area of PHP codes:

if ( have_posts() ) : while ( have_posts() ) : the_post();
the_content();
endwhile; endif;

For the sidebar, it is required to use another WordPress function get_sidebar() to render WordPress sidebar, in most themes, you have to put it into theme file, as I mentioned above:
https://toolset.com/forums/topic/posts-repeated-twice-on-taxonomy-archive/#post-1403863

Q3) If it is a shortcode, you can put it into the WordPress Archive content directly:
[wildheart-breadcrumbs]

If you want to display it outsider archive page content area, you can put it in theme file with the PHP codes you mentioned above

#1404119

Hey Luo,

We'll be pushing this site live tomorrow. Feels good to get one last site out the door before the end of the year.
Thanks for yall your help.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.