Plugin lists only pages, instead ot the posts
-
Hi,
I added the same tags also either to the pages or the posts on the website.
I also added the Contextual Related Posts to some page with shortcode.
I setup the listing basis to tags.
The module appears on the test page, but it doesn’t list the posts with the same related tag, it shows only blank area.
Please be so kind and let me know, what is wrong.
Tahnk you very much!
The page I need help with: [log in to see the link]
-
Few questions:
What is the full shortcode you are using?
What is the settings for Post types to include? Plus other relevant settings that you changed in List tuning and Output from the default? If you can put up a screenshot somewhere of these two tabs might be easier. Any public hosting site.Lastly, we might need to dig into the query a bit. Can you install Query Monitor and check what the query generated is?
https://webberzone.com/support/knowledgebase/debugging-with-query-monitor/Hi,
I use this code:
[crp]I publised the test page, the Related posts should be visible at the bottom on the page:
https://aisstechnologies.com/solutions/corporate-communication-teszt/Setup:
Post types to include: posts
Under this option every fields are unchecked or empty.
Above this:
Number of posts to display: 6
Related posts should be newer than: 0
Order posts: By relevance
Randomize posts: unchecked
Related posts based on title and content: checked
Limit content to be compared: 0Thank you very muchh!
Queries (filtered for the plugin):
Sequence Query Caller Component Rows Time 44 SELECT option_value FROM URG0CyZ_options WHERE option_name = 'medium_crop' LIMIT 1 get_option('medium_crop') Plugin: contextual-related-posts 0 0.0003 45 SELECT option_value FROM URG0CyZ_options WHERE option_name = 'large_crop' LIMIT 1 get_option('large_crop') Plugin: contextual-related-posts 0 0.0002 46 SELECT option_value FROM URG0CyZ_options WHERE option_name = 'ald_crp_settings' LIMIT 1 get_option('ald_crp_settings') Plugin: contextual-related-posts 0 0.0002 222 SELECT t.*, tt.* FROM URG0CyZ_terms AS t INNER JOIN URG0CyZ_term_taxonomy AS tt ON t.term_id = tt.term_id INNER JOIN URG0CyZ_term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ('post_tag') AND tr.object_id IN (2840) ORDER BY t.name ASC WP_Term_Query->get_terms() Plugin: contextual-related-posts 1 0.0011 223 SELECT post_id, meta_value FROM URG0CyZ_postmeta WHERE <code>meta_key</code> = 'crp_post_meta' crp_exclude_post_ids() Plugin: contextual-related-posts 0 0.0004 224 SELECT URG0CyZ_posts.*, MATCH (URG0CyZ_posts.post_title,URG0CyZ_posts.post_content) AGAINST ('Corporate communication - teszt ') as score FROM URG0CyZ_posts LEFT JOIN URG0CyZ_term_relationships ON (URG0CyZ_posts.ID = URG0CyZ_term_relationships.object_id) LEFT JOIN URG0CyZ_icl_translations wpml_translations ON URG0CyZ_posts.ID = wpml_translations.element_id AND wpml_translations.element_type = CONCAT('post_', URG0CyZ_posts.post_type) WHERE 1=1 AND ( URG0CyZ_posts.post_date <= '2022-02-01 10:42:09' ) AND URG0CyZ_posts.ID NOT IN (2840) AND ( URG0CyZ_term_relationships.term_taxonomy_id IN (46) ) AND URG0CyZ_posts.post_type = 'post' AND ((URG0CyZ_posts.post_status = 'publish' OR URG0CyZ_posts.post_status = 'inherit')) AND ( ( ( wpml_translations.language_code = 'en' OR ( wpml_translations.language_code = 'en' AND URG0CyZ_posts.post_type IN ( 'et_header_layout','et_body_layout','et_footer_layout' ) AND ( ( ( SELECT COUNT(element_id) FROM URG0CyZ_icl_translations WHERE trid = wpml_translations.trid AND language_code = 'en' ) = 0 ) OR ( ( SELECT COUNT(element_id) FROM URG0CyZ_icl_translations t2 JOIN URG0CyZ_posts p ON p.id = t2.element_id WHERE t2.trid = wpml_translations.trid AND t2.language_code = 'en' AND ( p.post_status = 'publish' OR p.post_type='attachment' AND p.post_status = 'inherit' ) ) = 0 ) ) ) ) AND URG0CyZ_posts.post_type IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','et_pb_layout','project','cookielawinfo','et_header_layout','et_body_layout','et_footer_layout' ) ) OR URG0CyZ_posts.post_type NOT IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','et_pb_layout','project','cookielawinfo','et_header_layout','et_body_layout','et_footer_layout' ) ) AND MATCH (URG0CyZ_posts.post_title,URG0CyZ_posts.post_content) AGAINST ('Corporate communication - teszt ') GROUP BY URG0CyZ_posts.ID ORDER BY score DESC LIMIT 0, 18
WP_Query->get_posts()
Plugin: contextual-related-posts
- This reply was modified 2 years, 9 months ago by Webfolio Webdesign.
Thanks – this is helpful. From what I can see – last query – there are no posts found. Probably because of how many checks are in there and I’ll be frank I got a bit lost.
Could you please try a few things as I think we need to see at what stage it breaks.
First is turn on the option to Match with content – this will add more text to match.
Secondly, are you in a position to temporarily disable WPML. I see a lot of queries that it has hooked onto for the purpose of getting the same language but I’m not sure if that’s causing an issue.
Next, reset the plugin settings and then uncheck the Automatically add to as you’re using the shortcode and don’t need that.
There are two lines of post_type IN and post_type NOT IN which appears to clash – but hard to read given the length of the query.
Hi,
Match with content setup – Means you the Related posts based on title and content option? It is checked.
Unfortunately, I cannot deactivate wpml, it is a live page with active visitors.
Automatically add option was unchecked.
Is maybe the problem, that we added the tags to the pages and we would like to add the Related posts to pages with the shortcode?
As I known, the common solution is to use these only on posts, but I hope, this concept will also work with your plugin.
It would be essentiel from SEO and valuable content point of view.
Thank you very much!
Understood on WPML and live site. Any chance you can set up a staging site to test?
In the settings, can you include post types to also have pages. This might help.
Also, I don’t understand these two lines as they include and exclude post types which are the same. Do you have any post types included in the Settings?
AND URG0CyZ_posts.post_type IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','et_pb_layout','project','cookielawinfo','et_header_layout','et_body_layout','et_footer_layout' ) ) OR URG0CyZ_posts.post_type NOT IN ('post','page','attachment','wp_block','wp_template','wp_template_part','wp_navigation','et_pb_layout','project','cookielawinfo','et_header_layout','et_body_layout','et_footer_layout' ) )
Please can you reset the related posts settings first. Then just uncheck the Automatically add to as per above.
Would be helpful if you can share the screenshots of List Tuning and Outputs probably hosting them on imgbb
Hi,
If I reset the setup and setup post and page at the Post types to include option, and the only same tag option, than only one page will be listed with the same tag.
However I have also post with the same tag and I had to list this post on the page.
There is no chance to create staging site, unfortunately.
Thank you.It could be, for some reason, that the plugin can’t “find” the second post. One option to force this post to display would be to use the meta box when editing this page and enter the post ID there and this should force the post to display. You can also use other post IDs as relevant.
In terms of finding, I’m not sure if there could be other factors e.g. WPML excluding the post cause of language as the query generated isn’t as simple. But the manual posts because a good workaround.
Hi,
Unfortunately, we need an automatcally solution, because they goint to upload a lot of articles, but thank you anyway!Understood. With more articles it might get better results but I understand it might still not be an ideal solution.
- The topic ‘Plugin lists only pages, instead ot the posts’ is closed to new replies.