Support » Plugin: Contextual Related Posts » How to Disable In Custom Pages ?

Viewing 11 replies - 1 through 11 (of 11 total)
  • Plugin Author Ajay

    (@ajay)

    You can edit the post and in the meta box at the bottom select “Do not display”

    Thread Starter ir4mt

    (@ir4mt)

    OoOoOo !

    super thanks

    @ajay – I’ve tried this both on the page and via the settings page to exclude from Pages (type), and by ID number, and it still displays. Is this a known bug?

    CRP v2.4.1
    WP v4.9.4

    Thanks!

    Plugin Author Ajay

    (@ajay)

    @jeffreyscottfrench

    Not that I am aware of. It works in all my tests. Have you cleared the cache if this was enabled?

    I think I sourced the issue:

    The echo_ald_crp function was being called manually from functions.php in the theme. This may have been because CRP is not (and likely was not at the time of theme authoring) displaying on “single-post” post types. CRP may have also had less placement options in the available settings at that time as well. Since the theme is a child theme of a framework, it may have been the decision that calling it in functions.php may have been cleaner in regards to ease of updating the child theme/parent theme set.

    Was there a decision to make the default action be to not include CRP on single-post pages?

    Plugin Author Ajay

    (@ajay)

    I have a feeling it’s theme specific changes that were done.

    By default CRP displays on all single posts, pages or post types.

    The plugin has always used is_single which applies to all post types except pages.

    Is there anything in your functions.php that removes the actions that CRP adds to automatically add content? It could be because they wanted to style it in a particular way and hence disabled the action.

    Side note: I’m quite happy to hear that there are themes that integrate my plugin 🙂

    Its built on the genesis framework, and I’m not seeing anything in the child theme that would be altering the post_type at the first glance. CRP is looking on the page for a specific class in the body tag, or is querying the database?

    Plugin Author Ajay

    (@ajay)

    Can you post what code is being used?

    CRP queries the database:

    This is the code behind CRP for the exclusion if you’ve selected the post from the Metabox to be excluded: https://github.com/WebberZone/contextual-related-posts/blob/master/includes/modules/exclusions.php

    This is when entered from the settings page: https://github.com/WebberZone/contextual-related-posts/blob/master/includes/main-query.php#L427

    A good way to debug is to install Query Monitor plugin and browse to a post on your blog where you are seeing these posts not being excluded and check what query is generated by the plugin

    • This reply was modified 4 years, 1 month ago by Ajay.

    Ok, so after some research: CRP is being called manually from functions.php to ensure a very precise placement in the post-footer. This means that none of the CRP placement settings are being used/abided by in order to achieve this. This looks like its still the best option, and just hiding CRP with some javascript if it’s on a “Page.”

    Hope this wasn’t keeping you up at night… Commenting the code better would’ve helped here – thanks for nothing, past me!

    If you want to see it in this particular use (with some custom css), check http://blog.brettmatthews.com/

    Plugin Author Ajay

    (@ajay)

    functions.php is a theme thing not a plugin thing.

    So, rather confused as to what you were trying to implement and how. But, glad you got that to work fine.

    jeffreyscottfrench

    (@jeffreyscottfrench)

    If I’m remembering correctly: neither the plugin’s positioning method nor the standard positioning method of items in WordPress (using 1-15 or whatever it is) was accurate enough to insert the plugin exactly where I wanted it, so I manually called and placed it inside the block I needed via functions.php. CRP really is a pretty slick little plugin though, so thanks for all your work on it!

Viewing 11 replies - 1 through 11 (of 11 total)
  • The topic ‘How to Disable In Custom Pages ?’ is closed to new replies.