I’m migrating an old site (using an old theme) which isn’t using Gutenberg Block Editor, but “Classic Editor” and “Classic Widgets” plugins instead.
The widget works only in the context of the theme header (mega menu) and footer. The widget does’nt work when used on a page context, e.g. embedded using “Widgets On Pages”-plugin. Also the shortcode (used within a page content) doesn’t work, meaning NOT showing the correct filtered category postings, but a listings of posts from another category. So i have to use the WRONG cat-id as a value for include_cat_ids shortcode param to get the results from my original one. Very weired!
In my example: using include_cat_ids=”255″ instead of correctly “258”.
But wait: As i’ve checked the value shifts for this comment, i’ve seen, that it is always a difference of “3” !?? => I’ve found a curious – temporary 🙂 – workaround for my problem! Now verified that with another page, if i use “cat-id minus 3” the correct/desired listing is produced.
Another info: In my original comment i’ve stated the context are posts, but i’ve used the shortcode only within pages (if that matters).
From Query Monitor: is_page, is_singular,
Header query (working as expected) – used in a mega menu: WP_Query->get_posts()
SELECT wp_posts.*,wp_top_ten.postnumber, wp_top_ten.cntaccess as visits, wp_top_ten.blog_id
FROM wp_posts
LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
INNER JOIN wp_top_ten
ON wp_top_ten.postnumber=wp_posts.ID
WHERE 1=1
AND ( wp_posts.post_date <= ‘2024-04-12 13:37:47’ )
AND ( wp_term_relationships.term_taxonomy_id IN (2337,2343) )
AND wp_posts.post_type = ‘post’
AND ((wp_posts.post_status = ‘publish’
OR wp_posts.post_status = ‘inherit’))
AND wp_top_ten.blog_id IN (‘1’)
GROUP BY wp_posts.ID
ORDER BY wp_posts.menu_order, wp_top_ten.cntaccess DESC
LIMIT 0, 27
Page context (*working*, but using WRONG cat-id 240 instead of 243): WP_Query->get_posts()
Shortcode: [tptn_list include_cat_ids=”240″ limit=”20″ heading=”0″ daily=”0″ how_old=”9999″ show_date=”1″ show_excerpt=”1″ disp_list_count=”1″]
SELECT wp_posts.*,wp_top_ten.postnumber, wp_top_ten.cntaccess as visits, wp_top_ten.blog_id
FROM wp_posts
LEFT JOIN wp_term_relationships
ON (wp_posts.ID = wp_term_relationships.object_id)
INNER JOIN wp_top_ten
ON wp_top_ten.postnumber=wp_posts.ID
WHERE 1=1
AND ( ( wp_posts.post_date >= ‘1996-11-26 00:00:00’
AND wp_posts.post_date <= ‘2024-04-12 13:37:47’ ) )
AND ( wp_term_relationships.term_taxonomy_id IN (240) )
AND wp_posts.post_password = ”
AND wp_posts.post_type IN (‘post’, ‘page’)
AND ((wp_posts.post_status = ‘publish’
OR wp_posts.post_status = ‘inherit’))
AND wp_top_ten.blog_id IN (‘1’)
GROUP BY wp_posts.ID
ORDER BY wp_posts.menu_order, wp_top_ten.cntaccess DESC
LIMIT 0, 60