Skip Navigation

[Resolved] AZ Glossary

This support ticket is created 7 years, 3 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)

Tagged: 

This topic contains 2 replies, has 3 voices.

Last updated by Castel 7 years, 3 months ago.

Assisted by: Minesh.

Author
Posts
#476036

I've been asked to create a glossary for a website.

The spec is that there is a list of glossary items. At the top of the page there is the alphabet (listed horizontally so A | B | C | D | E | F | G etc). When you click on a letter the list filters to show the glossary items that start with that letter.

This seems like something I should be able to do with Toolset but I can't quite work out how.

Is there a way to do this?

Thanks!

#476253

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Yes, 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/

#618209
Schermata 2018-02-21 alle 12.08.27.png
Schermata 2018-02-21 alle 12.08.56.png
Schermata 2018-02-21 alle 12.07.24.png
Schermata 2018-02-21 alle 12.09.24.png
Schermata 2018-02-21 alle 12.09.48.png

hi,
i have the same need, so i followed the steps provided in this thread, but it's only partially working: if you look at hidden link, you'll see that the glossary is created in the taxonomy view (on the left), and that the posts of the alphabet cat are listed, but the single-letter filters don't work.

the setup part is working, because not all the letters are present, and the ones that are not in the glossay list are correctly dropped because no posts are marked for those taxonomy terms (letters J, K, W, Y), so i think that the only part that isn't working is the filter selection output: if i select someting (e.g. the "E" letter), i get no output:

hidden link

did i forgot something? please notethat i exactly did the specified steps, but only those ones (1, 2 and 3 from the Minesh post of January 11, 2017 at 6:59 am), so if i need to add some other actions, thi is the problem 🙂

if you need i can provide admin access to WP.

thx,
s.

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