Solved

PHP code in wordpress site

Posted on 2014-03-20
3
417 Views
Last Modified: 2014-03-25
Hi,
I'm managing a Wordpress site that I did not create.
There is an area on the site that shows thumbnails of videos posted into the youTube account of the site owner. Those thumnails are shown and if you click on one, it plays.
I've been asked to add a new video to the site.  I know I need to upload it to YouTube first, but I'm looking at the code on the WP site and I'm not understanding how it's getting a video list. It looks to me that $videos is just being assigned to an empty array.  The code below shows the first time in the code where $videos is mentioned (  $videos = array())
Any help in figuring out this code would be appreciated.

Thanks!


 $videos = array();
                                $winner_story = null;
                                $featured_convention = new WP_Query(array(
                                        'posts_per_page' => 1,
                                        'post_type' => 'convention',
                                        'orderby' => 'ID',
                                        'order' => 'DESC',
                                        'meta_query' => array(
                                        array(
                                                'key' => 'convention_featured',
                                                'value' => 'on',
                                        )
                                        )
                                ));

                                while ( $featured_convention->have_posts() ) : $featured_convention->the_post();
                                        $custom = get_post_custom($post->ID);
                                        $videos = isset($custom["_videos"])? unserialize($custom["_videos"][0]) : array();
                                        $winner_story = (isset($custom["winner_story"]))? $custom["winner_story"][0] : "";

                                        ?>
                            <div class="video-container">
                                <?php
                                        if( isset($videos[0]) && !empty($videos[0]) ){
                                                ?><iframe width="514" height="330" src="http://www.youtube.com/embed/<?php echo youtube_videos_get_id($videos[0]) ?>" fra
meborder="0" allowfullscreen></iframe><?php
                                        }else{
                                                if( has_post_thumbnail( $post->ID ) ){
                                                        get_the_post_thumbnail( $post->ID, 'convention_image');
                                                }
                                        }
                                ?>
                            </div>
0
Comment
Question by:nachtmsk
  • 2
3 Comments
 
LVL 32

Accepted Solution

by:
DrDamnit earned 500 total points
Comment Utility
Looks like that post has a custom field that stores the YouTube ids. Make sure custom fields are set to display, and look fora field that hasa list of YouTube ids.
0
 

Author Comment

by:nachtmsk
Comment Utility
ok. Where will I find that custom field def? In the WP admin area?
0
 
LVL 32

Expert Comment

by:DrDamnit
Comment Utility
No,  it will be in the post itself somewhere.
0

Featured Post

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

In Part I (http://www.experts-exchange.com/Web_Development/Blogs/WordPress/A_8410-Getting-Started-In-WordPress-Part-I.html), I introduced you to the powerful WordPress backend, the WordPress administrative Dashboard.  In Part II, I will introduce yo…
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
The purpose of this video is to demonstrate how to Import and export files in WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Click on Too…
The purpose of this video is to demonstrate how to integrate Mailchimp with WordPress, by placing a Mailchimp signup form on a WordPress Page or Post. This will be demonstrated using a Windows 8 PC. Mailchimp will be used. Log into your Mailchi…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now