Skip Navigation

[Gelöst] tags are not shown in view

This support ticket is created vor 3 Jahren, 3 Monaten. 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.

Heute stehen keine Supporter zur Arbeit im Werkzeugsatz-Forum zur Verfügung. Sie können gern Tickets erstellen, die wir bearbeiten werden, sobald wir online sind. Vielen Dank für Ihr Verständnis.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

Dieses Thema enthält 15 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von Jim vor 3 Jahren, 3 Monaten.

Assistiert von: Minesh.

Author
Artikel
#2143653

Jim

I have a view that shows posts (filtered by a certain category).
I display the featured image and the post title.

Now I also want to show the tags of the posts here but they do not show up. Just empty.
The posts do have tags because when you click to the posts you can see the tags.

Is this a bug or am I doing something wrong..?

#2143889

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

Thank you for getting in touch.

Would you mind allowing me to have admin access to the site so that I can have a look at this for you ?

I've enabled the private fields for your next response.

Also please let me know the page that you're having the issue on.

Thanks,
Shane

#2144043

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

Some of the tags are actually showing fine.

I checked on the posts and the only ones that are not showing are the ones that don't have tags. Also i see that you have some custom code as well that could be interfering with the function of the view.

When I disabled the view the tags showed fine as well as when I used the filter to filter the view.

Thanks,
Shane

#2144057

Jim

Hello Shane,
that custom code is needed for the functionality. And that might interfere with the tags yes.

So we might have found the problem. But now the page does not work as it should anymore. I enabled the custom code again but the page does not filter to the chosen category (from the query string in the url).

Did you change the view aswell?

#2144077

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

I had removed and re-added the filter. Its quite possible because the URL parameter name had changed from "cucategory" to "wpv-congres-categorie" when I re-added the filter in my tests.

You should be able to just set back the parameter in your code to "wpv-congres-categorie" to restore the functionality.

Thanks,
Shane

#2144079

Shane
Supporter

Sprachen: Englisch (English )

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

The issue is essentially being caused by your tax query here

 $query_args['tax_query'][] = array(
          								'taxonomy'=>'congres-categorie',
                                        'field'=>'id',
                                        'terms'=>array($_GET['tid']),
                                         'operator'=>'IN',
                                        'include_children'=>1
        							);
      }
#2144383

Jim

Hi Shane,
I changed the filter url parameter and now that is working again. Also the tags show up fine.

Only thing that is not working anymore is the dropdown filter to only show child terms of the chosen category.
That one was solved in my previous ticket:

https://toolset.com/forums/topic/view-filter-to-filter-on-child-taxonomy-terms/

Did you change some custom code maybe?

#2144757

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

It should be working now.

I've set back the code to how it was by re-adding this.

$query_args['tax_query'][] = array(
                                       'taxonomy'=>'congres-categorie',
                                       'field'=>'id',
                                       'terms'=>array($_GET['tid']),
                                        'operator'=>'IN',
                                       'include_children'=>1
                                   );
     }

As mentioned this is overwriting the taxonomy query which causes the tags not to show up.

Thanks,
Shane

#2144887

Jim

Yes, it's working again now. Thnx

But now I am back to square 1 😉
How do I get that code to not interfere with the tags..?

Minesh helped me with the other code.
Are you able to alter the code sdo that the page keeps functioning correctly and the tags are shown, or should we call in the help of Minesh?

#2145065

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

I believe we have a way of fixing this, however it involves the use of a different hook to essentially curate the terms.

I'm assuming the tid=19 parameter in the URL is the ID of the parent taxonomy correct?

Please let me know.
Thanks,
Shane

#2145141

Jim

Hi Shane,
yes that is correct. tid=the taxonomy id but that is used for a different view on the same page (the taxonomy description).

The url parameter 'cucategory' is passed to this page to filter the right taxonomy (look at the views query filter)

IN this case: versteckter Link

ash-2020 is the taxonomy slug that is used for the filtering of the right taxonomy.

tid=19 is passed to the taxonomy description view.

Hope that clears things up

#2145849

Shane
Supporter

Sprachen: Englisch (English )

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

Hi Jim,

I've consulted with Minesh on this one to help provide a solution.

I will be passing this ticket to him so that he can continue assisting.
Thanks,
Shane

#2146295

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hi Jim,

Can you please tell me whats working and whats not working and accordingly I'll take a look and check whats going wrong with the setup.

#2146455

Jim
tagsmissing.png

Hi Minesh,
I have added another taxonomy (tags) to the view but they do not show up. Look at the attachment.

Check this url for example:
versteckter Link

(if you click through you can see those posts do have tags (under the title))

#2146547

Minesh
Supporter

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

I've adjusted the code added to the "Custom Code" section offered by Toolset as given under:

add_filter( 'wpv_filter_query', 'func_filter_posts_by_parent_term',99,3);
function func_filter_posts_by_parent_term($query_args, $view_settings, $view_id) {
    
    if($view_id==92){
             
      if(isset($_REQUEST['search']['dps_general']) and $_REQUEST['search']['dps_general'][0]['name']=='cucategory' and $_REQUEST['search']['dps_general'][0]['value']==0){
        
        $query_args['tax_query'][] = array(
                                       'taxonomy'=>'congres-categorie',
                                       'field'=>'id',
                                       'terms'=>array($_REQUEST['extra']['tid']),
                                        'operator'=>'IN',
                                       'include_children'=>1
                                   );
     }
    
    }
  return $query_args;
}

add_filter( 'wpv_filter_taxonomy_frontend_search_get_terms_args', 'prefix_modify_get_terms_args', 10, 3 );
 
function prefix_modify_get_terms_args( $args, $taxonomy, $view_id ) {
  if($view_id==92){
     
     if(isset($_REQUEST['action']) and $_REQUEST['action'] == 'wpv_get_view_query_results'){  
   			 $args['parent'] = $_REQUEST['extra']['tid'];
   
  }else{
    $args['parent'] = $_GET['tid'];
  }
    }
    
    return $args;
}

Can you please confirm it works at your end as expected?