|
Get the slug of the grandparent of the taxonomy archive
Started by: liatG
in: Toolset Professional Support
Quick solution available
Problem: I would like to be able to get the slug or ID of a taxonomy term ancestor of the current taxonomy archive term.
Solution: Use a custom shortcode to return either an ID or a slug:
function n_level_term_func($atts) {
$a = shortcode_atts( array(
'n' => '0',
'format'=>'id',
), $atts );
$current_taxonomy = get_queried_object()->taxonomy;
$id = 0;
$slug = '';
if( $current_taxonomy == 'class-part' ) {
$ancestors = get_ancestors( get_queried_object()->term_id, $current_taxonomy );
$count = count( $ancestors );
$id = isset( $ancestors[ $count - $a['n'] ] ) ? $ancestors[ $count - $a['n']] : get_queried_object()->term_id;
$term= get_term( $id, $current_taxonomy);
$slug = isset($term->slug) ? $term->slug: $slug;
}
return $a['format']=='slug' ? $slug : $id;
}
add_shortcode("n-level-term", "n_level_term_func");
Then you can use the "format" attribute to specify if you want a "slug". Otherwise, an "id" will be returned:
Slug: [n-level-term n="2" format="slug"]<br />
ID: [n-level-term n="2"]<br />
You may have to re-register the new shortcode name in Toolset > Settings > Front-end content.
|
|
2 |
4 |
6 years, 2 months ago
liatG
|
|
Divi Builder – Toolset – Bootstrap (compatibility update)
Started by: CharlesB2907
in: Toolset Professional Support
Quick solution available
|
|
2 |
4 |
6 years, 3 months ago
Shane
|
|
Help Using Custom Taxonomies to Create Online Tutorials and Their Navigation
Started by: liatG
in: Toolset Professional Support
Quick solution available
Problem: I would like to use a custom taxonomy to organize site content, and I need some advice about setting up pagination, archives, custom URLs and access restrictions.
Solution: See below for some general recommendations, and open separate tickets for each issue so we can discuss in detail.
|
|
2 |
3 |
6 years, 3 months ago
liatG
|
|
Changes in documentation and learning order
Started by: pedroS-7
in: Toolset Professional Support
Quick solution available
|
|
2 |
3 |
6 years, 3 months ago
pedroS-7
|
|
Advice connecting post types to create online tutorials
Started by: liatG
in: Toolset Professional Support
Quick solution available
Problem: I need some advice about how to use Toolset for my project.
Solution: Per our video chat, we will address individual issues in separate tickets.
|
|
3 |
12 |
6 years, 3 months ago
liatG
|
|
Issue in dashboard with registration
Started by: julietA
in: Toolset Professional Support
Quick solution available
Problem: I see a warning message that my registration is not valid, but it seems to be registered correctly.
Solution: We're aware of a problem affecting new and existing User registrations and site keys. Please go to Plugins > Add New > Commercial tab and click "Check for Updates" in the Toolset plugins panel.
|
|
2 |
3 |
6 years, 5 months ago
julietA
|