'0', ), $atts ) ); //** //SANITIZE ALL SHORTCODE INPUTS //Check for valid ID $postid = intval($id); if ($postid==0 || !is_int($postid)){ //Return error return '
Invalid Parallax ID
'; } //** //SETUP WP QUERY TO RETREIVE POST //Set up the arguments for query $args = array( 'page_id' => $postid, 'post_type' => array( PARALLAX_POSTTYPE ) ); //Look up the header $post = new WP_Query( $args ); //** //RETRIEVE THE POST AND DISPLAY //Check post exist if ( $post->have_posts() ) { while ( $post->have_posts() ) { $post->the_post(); //** //CHECK AND SANITIZE POST INPUTS // check if the post has a Post Thumbnail assigned to it. if ( !has_post_thumbnail() ) { //Error because of no image wp_reset_postdata(); return 'No Feature Image Defined!
'; } //Get thumbnail url $thumb_id = get_post_thumbnail_id(); $thumb_url_array = wp_get_attachment_image_src($thumb_id,'thumbnail-size', true); $thumb_url = $thumb_url_array[0]; //Get the height $pheight = absint(get_post_meta(get_the_id(), 'parallax_meta_height', true)); //Check the height if ($pheight==0 || $pheight| ';
$output = $output . ' ' . get_the_title() . ' ';
$output = $output . ' |
No Parallax Found! Check ID
'; } //Return the result return $output; } //Add the shortcode trigger add_shortcode( PARALLAX_SHORTCODE, 'register_sc_parallax_scroll' ); ?>