When saying “not working” you should include what you expect and what you get; “not working” says very little about the problem you have. Without knowing what the exact problem you have, I guess you don’t see the image. In that case I suggest to change this:
wp_get_attachment_image($photo_id, 'thumbnail');
With:
echo wp_get_attachment_image($photo_id, 'thumbnail');
wp_get_attachment_image() returns the HTML image element, but doesn’t print it.
Related Posts:
- Programmatically add widgets to sidebars
- Loading scripts only if a particular shortcode or widget is present
- Limit number of Widgets in Sidebars
- Give Editor Access To Sidebar
- Where is the content of widgets stored in mysql table
- Translate widget titles using qTranslate plugin
- Get number of widgets in sidebar
- How Do I Add Custom CSS To Only Certain Widgets
- Add the sidebar/widget editor to the post edit screen?
- Show Woocommerce minicart widget in checkout page sidebar? And, how to make this update secure by overriding widget?
- Get sidebar parameters (before_widget, before_title, etc.) from within a widget
- How to add image uploader to a custom widget?
- Different widgets on different page templates?
- Widgets not displaying in theme customizer
- $post>ID displays wrong post ID
- Register multiple sidebars
- Getting post-thumbnails from another WP site
- How to add author details in the post sidebar?
- Determining a Widget Instance and Sidebar Location?
- Randomize widgets displayed in my sidebar [duplicate]
- Video Embed in Sidebar Widget with Links to Others in Category
- Remove All Widgets from Sidebar
- Add div class to only one widget
- Unregistering a Sidebar in Child Theme
- Add a select box to all widgets
- Problems with the sidebar args and wp_list_bookmarks
- How to avoid widgets added to sidebar on theme activation?
- Ban certain widgets from certain sidebars
- Manual display of widget
- Sidebar Widget Registration without a name, how is it assigned to new named sidebar widget?
- is_active_sidebar() Always Returns False
- Call sidebar from a template
- How could a Widget behave differently depending on sidebar
- Adding classes to dynamic sidebar
- Is there a way to allow only certain type of widgets in the sidebars?
- Display sidebar that created in functions.php
- Create variable from widget instance
- Save/update widget outside admin panel [closed]
- WordPress: Apply filter/hook to a particular sidebar widgets?
- How to insert widget areas specific to certain pages (or posts, etc.)?
- List sidebars on a page
- Why use dynamic_sidebar() conditionally?
- wordpress widget textbox in the sidebar
- WordPress Widget multiple use
- Contact Form in sidebar [closed]
- More flexible sidebar and widget management
- Flickr plugin that will display photos from multiple group pools? [closed]
- WordPress widget new instance creates content duplicates
- dynamic_sidebar() returns false in admin section
- duplicate sidebar
- How to check if searchform.php is being included as widget?
- the_widget() and widget’s ID
- How to get sidebar’s content inside admin-ajax?
- Removing custom widget area WordPress 4.4 [closed]
- Insert Widget option into mark-up with register_sidebar
- Full width layout for custom post type pages
- How to “pair” two widgets side by side in one sidebar [closed]
- How to put Stack Exchange Flair as widget?
- Adding custom html and standard widgets to sidebar
- Dynamic Sidebars On Multiple Subpages
- How to add new sidebar widget area to child theme?
- Cannot save widgets in custom sidebars
- Check which registered sidebar a widget is added to
- Disable widgets on specific posts
- Display the id list of active widgets of same sidebar?
- How to remove a widget from the sidebar on specific page?
- Add individual tag to widget title in sidebar
- Excluding specific widgets from default sidebar class
- Can WordPress Read Its Own RSS Feed?
- different class (css) for sidebar widgets
- Can’t see widget areas in my customizer
- Remove image height/width attributes from Image Widget
- Dynamic sidebar based on category
- Widgets not activated alert after using get_sidebar()
- Image Uploader API
- How to show different widgets on different pages in a user friendly way
- Show widget differently depending on if it’s in the sidebar or footer
- How can I assign widgets from WP to appear in bbpress?
- Automatically hide Widgets that would lengthen page
- user definable sidebar per page
- Call sidebar from a template
- Show or hide custom menu widget in side bar conditionally
- Custom tabs widget don’t work in google chrome, is blocked, do not change the tabs. Why?
- Single Widget Multi Sidebar
- Post Thumbnails on Sidebar Widgets
- Unique widget id in sidebar
- Correct way to add a block element to sidebar layout
- How to exclude a widget from showing up on a page?
- How to hide sidebar widgets in all pages except Hompage?
- How to completely remove the sidebar? [closed]
- Subpages menu on sidebar plus widgets
- How can I add multiple content-editable blocks without a plug-in?
- Putting a URL, for a preview, in a side bar
- How do I insert a photo at the top of the sidebar?
- Add a twitter feed to my WordPress website
- Keeping shortcode-generated widget and theme element in one line [closed]
- How to inject a virtual widget (i.e. without adding it to the database) to the sidebar
- How to tell if a dynamic sidebar is being displayed on page?
- Add custom settings to widget areas
- Can’t edit the widgets sidebar or footer