Solved

PHP code in wordpress site

Posted on 2014-03-20
3
422 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
ID: 39942818
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
ID: 39942870
ok. Where will I find that custom field def? In the WP admin area?
0
 
LVL 32

Expert Comment

by:DrDamnit
ID: 39943029
No,  it will be in the post itself somewhere.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

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…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…
The purpose of this video is to demonstrate how to set up the permalinks on a WordPress Website. 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 : Go t…

895 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