Skip Navigation

[Resolved] A-Z navigation of Contemplations (CPT) grouped by Subject (taxonomy)

This thread is resolved. Here is a description of the problem and solution.

Problem:
How to enable A-Z navigation of Contemplations (CPT) grouped by Subject (taxonomy). How do I get the A-Z navigation working for the View?

Solution:
Solution here:
https://toolset.com/forums/topic/a-z-navigation-of-contemplations-cpt-grouped-by-subject-taxonomy/#post-572210

Relevant Documentation:
https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query

This support ticket is created 6 years, 7 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
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by Noman 6 years, 7 months ago.

Assisted by: Noman.

Author
Posts
#571979
Screen Shot 2017-09-21 at 11.20.03 am.png

I'm trying to enable A-Z navigation of Contemplations (CPT) grouped by Subject (taxonomy).

I have the basic A-Z (taxonomy) navigation of Contemplations working here: hidden link

Now I need the Contemplations to be grouped by Subject, which I have achieved here: hidden link

but how do I get the A-Z navigation working for this View?

My original post is here: https://toolset.com/forums/topic/need-advice-on-optimal-information-architecture-before-i-start/

I got the A-Z navigation working by following this post: https://toolset.com/forums/topic/az-glossary/

#572039

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi Morktron,

Thank you for contacting Toolset support.

1. Can you please make sure all Toolset plugins are updated to latest versions as a primary check:
https://toolset.com/account/downloads/

2. Also can you please share your Debug Information with us so we can see it? I have enabled debug info box for your next reply:
https://toolset.com/faq/provide-debug-information-faster-support/

3. Can you please re-save Permalink settings from WP Dashboard >> Settings >> Permalinks page and see if it helps? And if you are using any custom permalinks, please try to use default ones of WP and see what happens.

4. Create a new Test view and enable A-Z navigation and see how it works.

5. If above does not solve the issue, please provide temporary access (WP-Admin and FTP Login info) to your site (preferably staging site), so that I can look into your setup and check the issue.

Your next answer will be private which means only you and I have access to it.

=== Please backup your database and website ===

✙ I would additionally need your permission to de-activate and re-activate Plugins and the Theme, and to change configurations on the site. This is also a reason the backup is really important.

✙ Please provide link to the [View] Edit Screen.

Thank you

#572210

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

View.png

Hello,

I managed to achieve some results, please check here: hidden link

1. I have used wpv_filter_taxonomy_query hook and added this code in child theme’s functions.php file:
Doc: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query

add_filter( 'wpv_filter_taxonomy_query', 'prefix_modify_tax_query', 10, 3 );
function prefix_modify_tax_query( $tax_query_settings, $view_settings, $view_id ) {
   
	if( isset($_GET['wpvalphabet']) && $_GET['wpvalphabet'] != '' ) {
		$tax_query_settings['name__like'] = $_GET['wpvalphabet'];
	}
    return $tax_query_settings;
}

function old_style_name_like_wpse_123298($clauses) {
	  remove_filter('term_clauses','old_style_name_like_wpse_123298');
	  $pattern = '|(name LIKE )\'%(.+%)\'|';
	  $clauses['where'] = preg_replace($pattern,'$1 \'$2\'',$clauses['where']);
	  return $clauses;
}
add_filter('terms_clauses','old_style_name_like_wpse_123298');

2. Added the filter in “Contemplations loop” view, see attached screenshot.

3. Removed the filter from “Subject loop” view.

I hope its good now. Thank you

#572347

Wow Noman, you are amazing, it is indeed working exactly how I need it to, thanks so much! 🙂

There is no way I could have written that code myself, I'm not even sure what it is doing.

Thanks Noman, you made my day! 🙂

#572504

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Glad to hear that it works good, thank you so much for the feedback 🙂 Have a great day and the weekend.

Thank you

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