Advertisement
kobial8

Flickr Photos Dynamic Sidebar

Mar 11th, 2015
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.00 KB | None | 0 0
  1. Step 01: Create a div in footer.php OR Anywhere required [WIDGETS AREAS] as follows:
  2.                        
  3.             <div class="col-27">
  4.                             <aside class="widget">
  5.                             <h4>Flickr Photos</h4>
  6.                             <ul class="flickr-feed"></ul> <!--flickr-feed class is IMPORTANT-->
  7.                             </aside>
  8.                         </div>
  9.  
  10. Step 02: Add the following CSS code in style.css file:
  11.  
  12. .flickr-feed {
  13.     margin: 16px 0 0 0;
  14.     overflow: hidden
  15. }
  16.  
  17. .flickr-feed li {
  18.   float: left;
  19.   list-style: outside none none;
  20.   padding: 0 44px 0px 0;
  21.   margin-left: -39px;
  22. }
  23.  
  24. .flickr-feed li img {
  25.     width: 50px;
  26.     border: 2px solid #eaeaea;
  27. }
  28.  
  29. .flickr-feed a:hover {
  30.     opacity: 0.7;
  31. }
  32.  
  33. Step 03: Put the plugin (available in andia agency theme) in  js folder and call it as  follows:
  34. <script type="text/javascript" src="<?php echo get_template_directory_uri(); ?>/js/jflickrfeed.js"></script>
  35.  
  36. Step 04: Put the following JS code in footer.php:
  37.  
  38. <script type="text/javascript">
  39.     <?php
  40.         $flickr_id = ot_get_option('flickr_id');
  41.     ?>
  42.     jQuery(document).ready(function($) {
  43.         $('.flickr-feed').jflickrfeed({
  44.             limit: 12,
  45.             qstrings: {
  46.                 id: '<?php echo $flickr_id; ?>'
  47.             },
  48.             itemTemplate: '<li><a href="{{link}}" target="_blank"><img src="{{image_s}}" alt="{{title}}" /></a></li>'
  49.         });
  50.     });
  51.  
  52. </script>
  53.  
  54. Step 04: Add theme option (theme-options.php) support to add flickr ID (Mine is: 82395793@N04) as follows:
  55.  
  56. 'sections'        => array(
  57.        array(
  58.         'id'          => 'footer_settings',
  59.         'title'       => __( 'Footer Settings', 'theme-text-domain' )
  60.       )
  61.     ),
  62.     'settings'        => array(
  63.             array(
  64.             'id' => 'flickr_id',
  65.             'label' => 'Flickr ID',
  66.             'desc' => 'Set Flickr Photo',
  67.             'type' => 'text',
  68.             'section' => 'footer_settings',
  69.             )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement