Viewing 4 replies - 1 through 4 (of 4 total)
  • I figured it out:
    around line 42, look for this:

    $args = array_merge($args, array(
    			'orderby' => 'rand',
    			'showposts' => 1,
    		));

    Add this:
    'post_type' => 'your_post_type_goes_here',

    So you end up with:

    $args = array_merge($args, array(
    			'orderby' => 'rand',
    			'post_type' => 'your_post_type_goes_here',
    			'showposts' => 1,
    		));

    I’m using AppThemes Vantage, so I use 'post_type' => 'listing',

    ??

    Plugin Author scribu

    (@scribu)

    Or, you could use the ‘random_post_args’ filter defined two lines above:

    function rpl_change_ptype( $args ) {
      $args['post_type'] = 'your_post_type_goes_here';
    
      return $args;
    }
    add_filter( 'random_post_args', 'rpl_change_ptype' );

    (the code can go in your functions.php file, or in another plugin etc.)

    Even better.

    Thanks scribu.

    Thread Starter couchseats

    (@couchseats)

    Amazing! Can’t wait to try this out.

    Thanks so much.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: Random Post Link] How to use for custom post types?’ is closed to new replies.