- This topic is empty.
-
AuthorPosts
-
April 20, 2013 at 9:25 pm #44271
asiek
ParticipantI followed [this](http://wp.tutsplus.com/tutorials/creative-coding/youtube-and-vimeo-video-gallery-with-wordpress/ “http://wp.tutsplus.com/tutorials/creative-coding/youtube-and-vimeo-video-gallery-with-wordpress/”) tutorial.
I have a Video page that displays all videos, and I turned each video item into a link that directs the viewer to a single-videos page. Now on single-video pages the selected video is a larger size at the very top. Underneath are the rest of the videos from the main Videos page.My question is, how can I remove that selected video from list on the single-videos page?
Pastebins//
-single-videos.php [http://pastebin.com/jt6dBdYP](http://pastebin.com/jt6dBdYP “http://pastebin.com/jt6dBdYP”)
-video-gallery.php [http://pastebin.com/qD6JF1BS](http://pastebin.com/qD6JF1BS “http://pastebin.com/qD6JF1BS”)
Here is a quick example of the current layout.
[http://i35.tinypic.com/30sdhyb.png](http://i35.tinypic.com/30sdhyb.png “http://i35.tinypic.com/30sdhyb.png”)
The “Selected Video” with green border is what I’d like to remove, only from that video’s single page…
Possible?
I hope so :x
I’d appreciate the help :)Thanks.
April 21, 2013 at 3:51 pm #132632asiek
ParticipantPlease help x(
April 21, 2013 at 4:09 pm #132634pixelgrid
Participantget the post id for the current selected video with
$selected_id = get_the_ID();
and pass it as an argument to the new wp query
$args = array( ‘post_type’ => ‘videos’, ‘posts_per_page’ => 10 ,’post__not_in’=>array($selected_id) );
$loop = new WP_Query( $args );April 21, 2013 at 4:17 pm #132636asiek
Participant@pixelgrid Thank you :) I’m a beginner though so I don’t quite follow…
April 21, 2013 at 4:20 pm #132637asiek
Participant@pixelgrid I replaced this
$args = array( ‘post_type’ => ‘videos’, ‘posts_per_page’ => 10 );
$loop = new WP_Query( $args );with the piece of code you suggested
$args = array( ‘post_type’ => ‘videos’, ‘posts_per_page’ => 10 ,’post__not_in’=>$selected_id);
$loop = new WP_Query( $args );but I am lost on where to add the first piece of code…
April 21, 2013 at 4:20 pm #132638pixelgrid
Participanti edited the code above the query should be
$args = array( ‘post_type’ => ‘videos’, ‘posts_per_page’ => 10 ,’post__not_in’=>array($selected_id) );
with the id as an array member
declare your $selected_id outside of the first loop where you display the selected video.
Then inside the loop set it to$selected_id = get_the_ID();
April 21, 2013 at 4:31 pm #132639asiek
Participant@pixelgrid Okay I replaced the $args code with:
$args = array( ‘post_type’ => ‘videos’, ‘posts_per_page’ => 10 ,’post__not_in’=>array($selected_id) );
I’m just still lost on how to declare the $selected_id etc.
(I have 0 experience with this type of stuff…)April 21, 2013 at 4:36 pm #132641pixelgrid
Participantunder
$videoid = get_post_meta($post->ID, “Video ID”, single);
write
$selected_id = get_the_ID();
April 21, 2013 at 4:40 pm #132642asiek
Participant@pixelgrid
So simple, but yet super difficult from my point of view jaja!
THANK YOU SO MUCH :D -
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.