• Hey there,

    So I needed to be able to show related posts in another post type.

    And as this probably could come handy for someone else (or even if you want to add it to your plugin):

    Line #82: added
    $same_post_types = get_option( 'relpoststh_sameposttypes', false);

    Modified the line right after:
    $query = "SELECT distinct ID FROM $wpdb->posts ";

    To be:

    if ($same_post_types) {
    			$extra_where = "";
    		} else {
    			$extra_where = "post_type = '" . $post_type . "' AND ";
    		}
    		$where = " WHERE ".$extra_where." post_status = 'publish' AND ID<>" . $id; // not the current post

    inside if ( $validation ) { (line 420ish)
    update_option( 'relpoststh_sameposttypes', $_POST['sameposttypes'] );

    And then a few lines after:
    $sameposttypes = get_option( 'relpoststh_sameposttypes', false );

    At last, added a new TR:

    <tr>
    	<th scope="row"><?php _e( 'Cross-type behaviour', 'related-posts-thumbnails' ); ?>:</th>
    		<td>
    			<input type="checkbox" name="sameposttypes" id="sameposttypes" value="1" <?php if ( $sameposttypes ) echo 'checked="checked"'; ?>/>
    			<label for="sameposttypes"><?php _e( 'Associate posts without considering the post-type', 'related-posts-thumbnails' ); ?></label><br />
    		</td>
    </tr>

    I can give you diff files, or provide more info to anyone who needs this.

    Have fun and a great day!

    http://wordpress.org/extend/plugins/related-posts-thumbnails/

  • The topic ‘Related on different post_types’ is closed to new replies.