WP Parallax Content Slider with custom post types

I needed to create a custom version of the plugin WP Parallax Content Slider that shows the contents of a custom post type in a parallax slider.

Here is how I’ve done it:

1. I set up a new custom post type called slides

$labels = array(
  	'name' => _x('Slides', 'slide'),
  	'singular_name' => _x('Slide', 'slide'),
  	'add_new' => _x('Add New Slide', 'slide'),
  	'add_new_item' => __('Add New publication'),
  	'edit_item' => __('Edit slide'),
  	'new_item' => __('New slide'),
  	'view_item' => __('View slide'),
  	'search_items' => __('Search slide'),
  	'not_found' =>  __('No slides found'),
  	'not_found_in_trash' => __('No slide found in Trash'),
  	'parent_item_colon' => ''
    );
    $args = array(
  	'labels' => $labels,
  	'public' => true,
  	'publicly_queryable' => true,
  	'show_ui' => true,
  	'query_var' => true,
  	'rewrite' => true,
  	'capability_type' => 'post',
  	'hierarchical' => false,
  	'menu_position' => null,
  	'supports' => array('title','editor','author','thumbnail','excerpt','comments')
);
    register_post_type('slide',$args);

2. then modified the plugin in order to select only the “slide” post type

$args = array( 'post_type' => array('slide'), // not 'page'
					   'orderby' => $prlx_sort,
					   'order' => $prlx_order,
					   'numberposts' =>  $prlx_slider_nb_articles,
					   'cat' => $cat );

		$myposts = get_posts( $args );

		// --------------------------------------------------------
		// HTML Output beginning

3. and finally tweaked the output display in order to show the contents and thumbnail:

/*
	 * Generate HTML output for an article slide
	 */
	function get_article_slide($title, $content, $link_article, $url_image, $title_length, $alt_image = 'Alternative text')
	{
		// Parameters
		if (strlen($title) > $title_length) $title = substr($title, 0, $title_length)."...";

		// Slide output
		$outputSlide  = "<div class='da-slide'>"."n";
		$outputSlide .= "<h2>".$title."</h2>"."n";
		$outputSlide .= $content."n";
		// $outputSlide .= "<a href='".$link_article."' class='da-link'>Read more</a>"."n";
		$outputSlide .= "<div class='da-img'><img src='".$url_image."' alt='".$alt_image."' /></div>"."n";
		$outputSlide .= "</div>"."n";
		return $outputSlide;
	}

WordPress Forum thread: WordPress › Support » Use with custom post types.