KS
Forum Replies Created
-
Forum: Plugins
In reply to: [YMC Filter] Advanced query to filter results based on current taxonomy pageThanks for the reply! I couldn’t figure this out, I’m essentially using the callback you reference above. After chitchatting with Perplexity, I eventually arrived at something that works:
1. It outputs the posts in the current taxonomy only (leistung)
2. It allows for filtering on the taxonomy defined in the plugin (ltag)
3. It updates the ltag filter to hide empty terms
For 3) I set this in admin, but because I’m filtering the initial output on a different taxonomy (leistung), the plugin filter wasn’t always accurate because not all leistung taxonomy terms have posts with the ltag as well.. if that makes sense.
Anyway, I’m posting the code I’m using now, in case it helps someone else. Not sure if it’s very efficient, but it seems to work OK.add_filter('ymc/filter/query/wp/allowed_callbacks', function($callbacks) {
$callbacks[] = 'custom_query_leistungen';
return $callbacks;
});
function custom_query_leistungen( $args ) {
$leistung_id = (int) $args['page_id'];
$ltag_terms = $args['terms'] ?? [];
$relevant_ltag_ids = get_relevant_ltag_terms($leistung_id);
$tax_query = ['relation' => 'AND'];
$tax_query[] = [
'taxonomy' => 'leistung',
'field' => 'id',
'terms' => $leistung_id,
];
if (!empty($ltag_terms)) {
$filtered_ltags = array_intersect($ltag_terms, $relevant_ltag_ids);
if (!empty($filtered_ltags)) {
$tax_query[] = [
'taxonomy' => 'ltag',
'field' => 'id',
'terms' => array_values($filtered_ltags),
];
}
}
return [
'post_type' => ['leistungen'],
'posts_per_page' => -1,
'tax_query' => $tax_query
];
}
add_filter('get_terms', function($terms, $taxonomies, $args) {
if (!is_admin() && in_array('ltag', (array) $taxonomies) && is_tax('leistung')) {
$leistung_obj = get_queried_object();
if ($leistung_obj && isset($leistung_obj->term_id)) {
$leistung_id = $leistung_obj->term_id;
$relevant_ltags = get_relevant_ltag_terms($leistung_id);
$terms = array_filter($terms, function($term) use ($relevant_ltags) {
return in_array($term->term_taxonomy_id, $relevant_ltags);
});
}
}
return $terms;
}, 10, 3);
function get_relevant_ltag_terms($leistung_id) {
global $wpdb;
$ltag_ids = $wpdb->get_col($wpdb->prepare("
SELECT DISTINCT tr_ltag.term_taxonomy_id
FROM {$wpdb->term_relationships} tr_leistung
INNER JOIN {$wpdb->posts} p ON tr_leistung.object_id = p.ID
INNER JOIN {$wpdb->term_relationships} tr_ltag ON p.ID = tr_ltag.object_id
INNER JOIN {$wpdb->term_taxonomy} tt_ltag ON tr_ltag.term_taxonomy_id = tt_ltag.term_taxonomy_id
WHERE tr_leistung.term_taxonomy_id = %d
AND p.post_type = 'leistungen'
AND tt_ltag.taxonomy = 'ltag'
", $leistung_id));
return array_map('intval', $ltag_ids);
}Forum: Plugins
In reply to: [YMC Filter] Advanced query to filter results based on current taxonomy pageThanks for the reply!
Ok I see, the callback overtakes most of the plugin settings. Then I don’t quite grasp if what I’m trying to do is possible.
I have one custom post type (leistungen) and two taxonomies (ltag and leistung).
1. In the plugin I set the to show all leistungen CPTs and filter on the terms of the ltag taxonomy.
2. I show the filter on my leistung taxonomy term pages, I can filter fine.
But because it outputs all CPTs and I only want to show the ones related to the current “leistung” taxonomy, I then created the callback, which limits the CPTs but breaks the ltag-taxonomy filter.
What I don’t understand is whether it’s possible to have a callback function that limits the CPTs output in the loop, but still allow for the taxonomy filter to function?Forum: Plugins
In reply to: [YMC Filter] Advanced query to filter results based on current taxonomy pageI do have one more question as well, which I couldn’t find any information about.
For my filter I’m using a taxonomy (ltag). When I click on a term, apart from sorting, I would like the show the taxonomy term description between the filter and item loop. Is this possible with the plugin?Forum: Plugins
In reply to: [YMC Filter] Advanced query to filter results based on current taxonomy pageHello, many thanks for the reply and the pointer about the callback!
I created a callback like this:add_filter('ymc/filter/query/wp/allowed_callbacks', function($callbacks) {
$callbacks[] = 'custom_query_leistungen';
return $callbacks;
});
function custom_query_leistungen( $args ) {
return [
'post_type' => ['leistungen'],
'posts_per_page' => -1,
'tax_query' => [
[
'taxonomy' => 'leistung',
'field' => 'id',
'terms' => (int) $args['page_id'],
]
]
];
}This picks up the taxonomy term page I’m on and I can limit the posts shown in the output to the current term, which is great. But I still don’t quite understand its limitations, because when I do this, the plugin filter – which is a different taxonomy – then no longer works.
How can I write the callback so that I limit the posts to the current taxonomy, but still allow filtration on the taxonomy I have defined in the plugin filter?Hello @architabasandrai20 many thanks for following-up on this, I just now realised that I had not replied. After delving deeper into this, I noticed I had “margin-bottom: 0px;” showing on some websites using Kadence and one some it wasn’t.
It turned out the “margin-bottom: 0px;” is not coming from Kadence, but from the GeneratePress theme. And now I feel pretty daft, but I actually had this issue last year and cleared it with the GP support team – but I managed to forget about it and didn’t find it when I was looking for solutions! https://wordpress.org/support/topic/generate_do_wp_block_margin_bottom/
Sorry about that, should be all clear now and hopefully after clarifying this twice, I might actually remember it next time!!Forum: Plugins
In reply to: [WP Table Builder – Drag & Drop Table Builder] Border-collapseThanks for the screenshot, I can see it now (partly). This is, however, a pro feature it seems, it’s not available in the free version of the plugin here in the repository and hidden behind a “PRO ONLY” blocker.
Forum: Plugins
In reply to: [WP Table Builder – Drag & Drop Table Builder] Border-collapseMany thanks for the quick reply @protibimbok
I can’t seem to find this setting under the Settings > General for either the plugin, or the individual table. I’m using the new version of the builder, not legacy.
If you can share more info on where the setting is, perhaps with a screenshot, that would be great!
Forum: Plugins
In reply to: [Footnotes Made Easy] Maximum execution timeHi Patrick, many thanks for the quick and informative reply!
- This happens even on pages without footnotes.
- 1,2… 10
- No
I have tried the temporary workarounds you suggested, as well as the “Suppress Footnotes” options, but it provides no quick fix. I have also tried turning of all plugins apart from Footnotes Made Easy, as well as switching to the 2025 standard theme, but that also doesn’t help.
What’s interesting, is that the problem happens on pages that don’t have any footnotes, such as the frontpage. Also, it happens in the admin, sometimes when opening pages I get errors such as:
Fatal error: Maximum execution time of 30 seconds exceeded in /wp-includes/query.php on line 413On a custom post type post (which is where I use the footnotes), I’m now getting an error relating to line another code line:
Fatal error: Maximum execution time of 30 seconds exceeded in /wp-content/plugins/footnotes-made-easy/footnotes-made-easy.php on line 308But this might just be it timing out earlier.
I’m not sure what else I can do to test, or how I can help bugfix? I also don’t know if this is just related to my (pretty standard ) server setup, or a more general bug. Unfortunately, if I deactivate the plugin, everything else works fine and fast.
- This reply was modified 4 months ago by Yui.
Thanks @iamjaypie, then I know. We’ll have a think about which version to use.
Hello Archita, many thanks for the reply and also for making the screencast!
Block defaults are useful and I’ve used them in the past, but precisely because they only add settings to new blocks getting added, I find they lack usability a lot of the time, especially if you already have a lot of content on your site using Kadence blocks.
To my mind, it would be more powerful to be able to define generic defaults that apply to a block’s settings, unless those settings have already been defined for a specific block. That way, I could change the defaults for all specific blocks, not just new ones getting added.
In my specific case, what I don’t understand is why Kadence adds a margin-bottom of 0 to the unique class of the block and not just to the block in general? If it added the margin to the “kb-row-layout-wrap” class instead, it would be easy enough to override this in your stylesheet, but because it gets added to the unique class, it complicates settings real defaults..
Hi @sadmansakibnadvi many thanks for the quick reply! Good to know corrupted files might have caused the issue, I guess after I manually uploaded v 6.2.1 and then updated in admin, that’s what helped fix the issue.
Thanks for the plugin and all the best.A different question, but still about the maps – does anyone know to change the marker redirect, so that it doesn’t open in a new tab? I’m linking internally from the map, so would prefer to stay in the same tab.
Hello – excellent, many thanks for your reply. After I added the comma, it seems to work again. Is that something that was changed in the last few versions? For us it was working previously without it.
Perhaps it would make sense to adjust the code that checks for plans, so that it’s possible to just add on – without a comma? Especially when using “any_plans”, it doesn’t make much sense having to add a comma.
Forum: Developing with WordPress
In reply to: Hierarchical CPT with year slugHello @bcworkz many thanks for your very useful reply! I hadn’t come across that filter before, very interesting.
Yes, the number slug restriction is due to pagination and in our case, it’s very unlikely to have pagination for 2024 pages, so that shouldn’t be an issue. I’m still in two minds about whether to disable the filter or not, it is useful to stop duplicates, especially if other people are working on the site and forgetting to be careful.
Either way, thanks a lot for pointing me in the direction of this filter!
Forum: Themes and Templates
In reply to: [GeneratePress] generate_do_wp_block_margin_bottomHello Tom, ah many thanks! I didn’t know about this dynamic caching of CSS function, even though I have built a whole bunch of sites with GP. Thanks for pointing this out!