Support » Plugin: WordPress Related Posts » Any Plans For Custom Post Type?

Viewing 5 replies - 1 through 5 (of 5 total)
  • PetraP

    (@petrap)

    Hey Scott,

    thanks for reaching out!
    Our plugin usually works with custom posts but it really depends on a lot of things, so I need a bit more information – what kind of custom posts do you use? Any special custom post plugin?
    For example, you could try this – I made this custom post type (‘a_product’):

    add_action( 'init', 'create_post_type' );
    function create_post_type() {
    register_post_type( 'a_product',
    array(
    'labels' => array(
    'name' => __( 'Petra' ),
    'singular_name' => __( 'Petra' )
    ),
    'public' => true,
    'has_archive' => true,
    )
    );
    }

    And then I have changed the init.php file of the plugin like so (just added the || ‘a_product’ after ‘post’ ):
    if ($content != "" && $post->post_type === 'post' || 'a_product' && (($options["on_single_post"] && is_single()) || (is_feed() && $options["on_rss"])))

    Don’t forget to save the changes and let me know how it goes,
    Petra

    Is there a way to do this without modifying the plugin’s init.php file? I’m worried if I do that, a future update could overwrite the change. It seems like it would be preferable to make this a choice in the plugin’s settings.

    Hi,

    unfortunately at the moment the only way to do this is to modify the init.php file, sorry. And yes, the update would overwrite the change – we had a lot of request to add is an option in the plugin settings but not sure if this will be implemented any time soon :/
    But you were able to modify the file and it works for you?

    All the best,
    Petra

    Hi!

    I just added the name of the post type and nothing happened.

    the custom post type:

    //it
    add_action( 'init', 'create_post_type_it' );
    function create_post_type_it() {
      register_post_type( 'it',
        array(
            'labels' => array(
                'name' => __( 'It' ),
                'singular_name' => __( 'It' )
            ),
            'public' => true,
            'has_archive' => true,
            'menu_position' => 5,
            'supports' => array('title', 'editor', 'excerpt', 'thumbnail')
        )
      );
    
    }

    the init.php
    if ($content != "" && $post->post_type === 'post' || 'it' && (($options["on_single_post"] && is_single()) || (is_feed() && $options["on_rss"]))) {

    I did saved the changes. Is there anything I’m doing wrong?

    Hey,

    it looks to me, you are doing everything right – which WP theme are you using? I have tested this on a couple of standard WP themes and it works.

    Looking forward to your reply,
    Petra

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Any Plans For Custom Post Type?’ is closed to new replies.