Skip to main content

Forums

This topic contains 5 replies, has 0 voices, and was last updated by  asiek 5 years, 7 months ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #45983

    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.

    Created my [Custom Post Type](http://pastebin.com/izt0bbqh “http://pastebin.com/izt0bbqh”), added Custom Fields (Text Input & Select Menu), then I named the fields “videoid” and “videosite” .
    The data remains when saved but the data isn’t called correctly within my page template :(

    When I view the page it says “Please select Video Type…”
    As if nothing was entered into the custom fields…

    If I use the easy method (Custom Field Template & Custom Post Types UI) Plugins, everything works, no errors or blank pages. But when I add the actual CPT and Fields to my functions.php it ends up not working…

    Why is that? What did I do wrong?

    Please Help :(

    **PHP** Used to get the video//

    < ?php
    /* Set variables and create if statement */
    $videosite = get_post_meta($post->ID, 'Video Site', single);
    $videoid = get_post_meta($post->ID, "Video ID", single);
    $selected_id = get_the_ID();
    if ($videosite == vimeo) {
    echo '';
    } else if ($videosite == youtube) {
    echo '';
    } else {
    echo 'Please Select a Video type.';
    }
    ?>
    #141066

    asiek
    Participant

    Anyone?

    #141068

    pixelgrid
    Participant

    go with a step by step debugging.
    first make sure you check for a string

    if ($videosite == ‘vimeo’)

    in your code you are missing the quotation marks

    then you can start echoing the $videosite variable after you have made sure that when you save a value in your post and save it it gets saved, meaning that after a refresh it stays in the placeholder

    #141072

    asiek
    Participant

    @pixelgrid wow another simple error. Thank you very much for pointing it out! The videos are now displayed :D

    #141252

    asiek
    Participant

    @pixelgrid Not sure what happened here but the videos aren’t working again. I added the quotation marks and it worked for a little while but now, the video container is empty again…

    :(

    Do you mind looking through a new pastebin to help out please?
    I am not sure if it’s the way my CPT is set up or my Custom Fields…
    *sigh*

    #141331

    asiek
    Participant

    Anyone have spare time on their hands?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.

icon-link icon-logo-star icon-search icon-star