Skip Navigation

[Resolved] Views displaying all items despite filter by Taxonomy

This support ticket is created 7 years, 6 months ago. 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.

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)

This topic contains 10 replies, has 2 voices.

Last updated by davidM-34 7 years, 6 months ago.

Assisted by: Minesh.

Author
Posts
#509437
Lexicon-A.PNG

I am trying to: List all Lexicon items that start with the letter A. I've assigned Taxonomy "A" to 2 posts (Lexicons) and created a View for it. See attached screenshot

I visited this URL: hidden link

I expected to see: only the first two items that start with the letter A. I assigned those two items the taxonomy of A. I will assign the A Taxonomy to the rest of the terms that start with the letter A once I get the View to work.

Instead, I got: A list of ALL posts.

#509611

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - starts with and taxonomy assigned is the different thing. I checked by creating view and assigned only one post to taxonomy term and its displaying only one post with view that's assigned to the term.

Are you looking for the character filter like this?
=> hidden link

#509922

Yes, that is exactly what I'm looking for. Is there a document on that?

#510098

Minesh
Supporter

Languages: English (English )

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

Could you please try to follow following steps:

es, its possible but needs some custom programming and few steps needs to follow:

1)
Create a taxonomy namely "alphabets" and add A to Z as terms.

2)
Now create a taxonomy view listing "alphabets" taxonomy terms. The loop output section should look like this:

[wpv-layout-start]
    [wpv-items-found]
    <a href="[current_url]">All</a>
    <!-- wpv-loop-start -->
        <wpv-loop>
            <a href="?wpvalphabet=[wpv-taxonomy-title]">[wpv-taxonomy-title]</a>
        </wpv-loop>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
        <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
    [/wpv-no-items-found]
[wpv-layout-end]

=> Add following code to your current themes funcitons.php file

/**
 * Register custom shortcode to output url of current page
 * Minus any url parameters
 */
add_shortcode( 'current_url', function(){
   
    $request = $_SERVER['HTTP_HOST'].strtok($_SERVER["REQUEST_URI"],'?');
    $protocol = '<em><u>hidden link</u></em>';
   
    if ( $_SERVER['HTTPS'] ) {
        $protocol = '<em><u>hidden link</u></em>';
    }
   
    return $protocol . $request;
} );

3)
Now create another view for which you want to display your posts filter by the taxonomy "alphabets" as URL param.

[wpv-layout-start]
[wpv-view name="alphabet-terms"]
[wpv-items-found]
<!-- wpv-loop-start -->
        <wpv-loop>
            <h3>[wpv-post-link]</h3>
        </wpv-loop>
    <!-- wpv-loop-end -->
    [/wpv-items-found]
    [wpv-no-items-found]
        <strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
    [/wpv-no-items-found]
[wpv-layout-end]

More info:
=> https://toolset.com/documentation/user-guides/filtering-views-by-taxonomy/

#510388

I will try this but I have some questions:

1. For the taxonomy, do I use Hierarchical or Flat?
2. Do I assign "Post Types to be used with this Taxonomy" to my post type=Lexicons?
3. Are there any other settings I need to worry about or keep everyting default?

#510407
lexicon-alphabets.PNG

OK, here's the page but the links are still showing everything when you click on A. As a test, I assigned Taxonomy A to Adoption Process. (see screenshot with two highlights.)

hidden link

Would you like to have access to our backend?

#510552

Minesh
Supporter

Languages: English (English )

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

1. For the taxonomy, do I use Hierarchical or Flat?
==> It should be flat taxonomy.
2. Do I assign "Post Types to be used with this Taxonomy" to my post type=Lexicons?
=> Yes.
3. Are there any other settings I need to worry about or keep everyting default?
==> it should be OK

But let me check on your install.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I would additionally need your permission to de- and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important. If you agree to this, please use the form fields I have enabled below to provide temporary access details (wp-admin and FTP).

I have set the next reply to private which means only you and I have access to it.

#511403

Minesh
Supporter

Languages: English (English )

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

Could you please check now.
=> hidden link

I've added the query filter to your view:
=> hidden link

Select posts with taxonomy:
Alphabets slug in one of those set by the URL parameter wpvalphabet
eg. <em><u>hidden link</u></em>

Now it looks like working fine.

#511808
missing query filter.PNG

Thank you, it looks great in Staging.

Now, I'm trying to add the query filter to our production server but the Edit View screen does not have that section available. See screen shot. How do I make that section available?

#512018

Minesh
Supporter

Languages: English (English )

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

Well - on top right side you will see the "Screen Options" click on that and check the checkbox with "Query Filter" and "Query Filter" section will be appear on your screen.

#512767

Thank you! It's up and running now in production. I just have to set the Alphabet taxonomy for each post.

Thanks for the great support!

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