Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End [WORDPRESS] How to remove “Selected” Item from list on it’s single page?

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #44271
    asiek
    Participant

    I 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/jt6dBdYPhttp://pastebin.com/jt6dBdYP”)

    -video-gallery.php [http://pastebin.com/qD6JF1BS](http://pastebin.com/qD6JF1BShttp://pastebin.com/qD6JF1BS”)

    Here is a quick example of the current layout.

    [http://i35.tinypic.com/30sdhyb.png](http://i35.tinypic.com/30sdhyb.pnghttp://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.

    #132632
    asiek
    Participant

    Please help x(

    #132634
    pixelgrid
    Participant

    get 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 );

    #132636
    asiek
    Participant

    @pixelgrid Thank you :) I’m a beginner though so I don’t quite follow…

    #132637
    asiek
    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…

    #132638
    pixelgrid
    Participant

    i 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();

    #132639
    asiek
    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…)

    #132641
    pixelgrid
    Participant

    under

    $videoid = get_post_meta($post->ID, “Video ID”, single);

    write

    $selected_id = get_the_ID();

    #132642
    asiek
    Participant

    @pixelgrid
    So simple, but yet super difficult from my point of view jaja!
    THANK YOU SO MUCH :D

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.