Solved

PHP code in wordpress site

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

WordPress is constantly evolving, and with each evolution appears to get better and better.  One of the big drawbacks prior to version 3 was that there was no way to be able to set up a custom menu from the backend. The Old Way Adding menus is…
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…

792 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