Solved

PHP code in wordpress site

Posted on 2014-03-20
3
427 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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
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…
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 viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

773 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