I have a custom theme which has a footer.php file, which contains my footer.
This footer contains two YouTube videos which I have currently hardcoded into the theme template file footer.php.
What I would like to do is control which videos are displayed in the footer from the WP Dashboard.
I am not sure what is the best way to approach this.
This is my code in footer.php
<div class="row">
<div class="col-md-6">
<iframe width="240" height="170" src="//www.youtube.com/embed/abcdefg" frameborder="0" allowfullscreen></iframe>
</div><!-- /.6 -->
<div class="col-md-6">
<iframe width="240" height="170" src="//www.youtube.com/embed/hijklm" frameborder="0" allowfullscreen></iframe>
</div><!-- /.6 -->
</div><!-- /.row -->
I was thinking of replacing the video URL with some variable somehow that is editable via my dashboard.
An approach I was looking at was http://mor10.com/simple-video-embedding-with-custom-fields-in-wordpress-youtube/comment-page-1/#comment-1253601
But this seems to be based around your page being a post.
Thanks
I dont suggest using Custom Fields or Meta boxes for this. As custom fields and meta boxes are used mostly per post/page basis. Basically it will only output the data entered if you are on that specific post or page.
I’d suggest widgets, here’s something you can use:
Register your new widget areas, add this to your functions.php file of your theme:
You can output it in your theme by editing your footer as:
Then you can just add the text widget to your Footer Area 1 and Footer Area 2 Widget areas in WordPress Dashboard -> Appearance -> Widgets, and insert their
<iframe>