Support » Plugin: Contextual Related Posts » Custom post types question

  • Resolved funky_buddah


    Hello all, I have the following situation:

    I’m using CRP on the default wordpress posts (single.php) and also on a custom post type (single-downloads.php).
    I’d like to customize where the related posts container is displayed in single-downloads.php.
    The content structure of the post types is different and the default display which is works ok in sigle.php is badly positioned in single-downloads.php.

    I tried to disable the automatic display of crp and manually insert the echo_ald_crp function and customize the positioning using css but this also messes up the positioning in some posts. The only good option for me is the default display (after the content).

    I think the best solution for now will be to display the related content in a sidebar widget in single-downloads.php. But now comes the problem: if I enable that, I come up with 2 related posts containers, one in the sidebar and one in the post’s content. How can I disable the one in the content?

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


    You could try this:

    If you know the post IDs for the single-downloads file, you can enter these in the “exclude display on following posts” field in the settings page.

    Then, like you did earlier, edit the single-downloads.php file to manually add the code to display the related posts.

    Thanks for the reply, Ajay.

    But I need an automatic solution, it’s a pretty big site.

    Plugin Author Ajay


    Unfortunately, there isn’t an automated solution for custom post level. I’ve got better custom post support in the pipeline, but unfortunately it’s not a quick fix.

    Is there a reason you don’t want to use only the widget for both single and single-downloads?

    I cannot use the widget on both post types because of different content structure and alignment issues.

    Or, can I use the widget on both post types and customize it with css? I mean can I assign different css classes and divs for the widget in order to have different layouts for crp in single and downloads?

    Plugin Author Ajay


    You can use the widget and style it with CSS.

    You’ll ideally need to put the different pieces of CSS in the single.php and single-downloads.php files.

    You could also try using Widget Logic plugin to control the widgets. I haven’t used this personally yet.

    Thanks man, I will try to do that.

    Any ideas on how can I assign different CSS styles to single and single-downloads? I’m not much of a CSS guru.

    Plugin Author Ajay


    Most likely, you’ll need to edit your header.php and use a conditional tag:

    So something like:

    if ( is_singular ('downloads') ) {
      ADD CSS Code for Single-downloads.php
    } else {
      ADD CSS Code for Single.php

    Thanks again. I think you’re the most helpful plugin author I had to deal until now 🙂

    Plugin Author Ajay


    You’re welcome 🙂

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Custom post types question’ is closed to new replies.