Solved

PHP code in wordpress site

Posted on 2014-03-20
3
443 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Why Off-Site Backups Are The Only Way To Go

You are probably backing up your data—but how and where? Ransomware is on the rise and there are variants that specifically target backups. Read on to discover why off-site is the way to go.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to prevent comment spam on a WordPress Website. This will be demonstrated using a Windows 8 PC. Plugin Akismet will be used. Go to your WordPress login page. This will look like the following: myw…

759 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