- This topic is empty.
-
AuthorPosts
-
June 30, 2013 at 3:22 pm #45983
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.
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//
/* 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.';
}
?>
June 30, 2013 at 5:40 pm #141066asiek
ParticipantAnyone?
June 30, 2013 at 5:49 pm #141068pixelgrid
Participantgo with a step by step debugging.
first make sure you check for a stringif ($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
June 30, 2013 at 6:06 pm #141072asiek
Participant@pixelgrid wow another simple error. Thank you very much for pointing it out! The videos are now displayed :D
July 2, 2013 at 3:10 am #141252asiek
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*July 2, 2013 at 2:38 pm #141331asiek
ParticipantAnyone have spare time on their hands?
-
AuthorPosts
- The forum ‘Back End’ is closed to new topics and replies.