Put this lines of code in function.php
if (function_exists("register_sidebar")) {
register_sidebar();
}
Put this to sidebar.php
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?>
<?php $image = new WP_query ('showposts=1');
if(have_posts()) : while($image->have_posts()) : $image->the_post; ?>
<a href="https://wordpress.stackexchange.com/questions/115901/<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to
<?php the_title_attribute(); ?>"><?php postimage(); ?></a>
<?php endwhile; endif; rewind_posts; ?>
Related Posts:
- Best strategy for providing theme options using customizer
- Using classes instead of global functions in functions.php
- How do register_sidebar() and get_sidebar() work together?
- Should I use set_transient or update_option?
- Template for individual post designs
- register_sidebar ignores ‘id’ and ‘class’
- Registering Sidebars and Sidebar Widgets. Sidebar Widgets Not Displaying
- Front End Post Submit Form
- Adding WordPress colorpicker in widget settings
- How do I display the “Archives” widget layout (sidebar) in WordPress by ‘year’ then by ‘months’?
- Upgrading a custom theme through the Dashboard
- Theme Customizer not loading
- Widgets not showing in my custom theme
- Is it a good idea to make whole theme widgetized?
- Version control for both Vagrant config and themes being developed [closed]
- How i can get widgets areas working in customizer?
- How to correctly add JQuery in a WP theme?
- How to add a second stylesheet to the editor
- WP 3.1 upgrade breaks AutoFocus+ theme
- How to make theme elements customizable in wordpress?
- Limitations when modifying wp_title with a filter
- How to edit theme functions file to modify pagination?
- “Add A Widget” button in the Customizer
- Customizer: save setting/control content to post/page
- Customize how a WordPress theme looks like in the Theme Selector
- Customizer – loading settings/controls/sections/panels based on a id/page id
- Integrate WooCommerce theme with a WordPress theme [closed]
- How do you use WordPress for a website that’s not in a blog format?
- Is it acceptable for a WordPress theme to not accept widgets?
- How can I hard code my sidebar?
- searchform.php doesn’t work properly
- Customizer: get_preview_url() inside customize_save_after hook
- New to WordPress – Read the Codex, Other Docs; Still Confused
- Create theme for mobile phones and tablets only?
- How to add custom page elements to the WYSIWYG editor?
- Can’t change theme name
- Remove/Hide a Widget on a Custom Template
- How to hide custom sidebar on mobile
- Text widget is placing everything side by side. I want to post it above
- Is hand coding required at all?
- WordPress Twenty-Fourteen: How to Remove Home Page Header Image from Other Pages
- How to dowload and edit content of a website
- Any way to permanently translate themes?
- How to prevent XSS attack in wordpress theme?
- What’s the policy for building a theme that doesn’t support widgets/menus?
- How Does One Create a Global Variable Repository
- How to convert that page to a wordpress template? [closed]
- Turning WordPress Into full-featured website?
- Using My Own Classes On Wp Unit Tests
- Migrated WordPress site renders Chinese
- Acivate all themes multisite wide automatically
- Echo all category names, apart from one
- How to enqueue javascript for WP Customize options sidebar?
- Is it possible to visually group items on the theme customizer?
- WordPress 500 Internal server error when activating custom theme [closed]
- How do i place same widgets multiple time by default on theme activation?
- Call to undefined function add_menu_page() on theme activation
- How to Find the Page the Front Page is Using?
- How to place HTML tags in content from the_content()?
- correct tags for validating input types
- WordPress Theme Creation [closed]
- Custom Blocks as part of a theme
- What is the meaning of WordPress’s recommended css classes and where are they applied?
- WooCommerce: multiple input field for multiple product variations
- How to set a page as homepage in stead of the newspages?
- Renaming a theme so it aids SEO and the theme used is hidden
- Admin: sub menu doesnt display under apperance when activate my themes
- Automated Footer information
- how to get the post attachement image in full size?
- How to use widget in a widget-less WordPress theme?
- How do I get the trackback count of a post in wordpress without writing an SQL query?
- Overrite parent functions using child functions
- Default Text not showing from customizer
- Best way to develop a new theme on a live site, with new content? [closed]
- How can I develop multiple widgets for a WordPress theme?
- Child Theme header1.php file not overwriting parent theme’s header1.php file
- How do I make the most minimal vanilla theme possible with nothing but raw content?
- Can I Set Up Session in WordPress Custom Page
- Does code in function.php differ from theme to theme
- WordPress 3.8 Backend Admin Color Scheme add more scheme how to do?
- WordPress Theme Validator?
- Should all references to a text domain be to my current theme?
- Theme thumbnail in dashboard
- If you were to start using a WordPress framework today, which one would you use? [closed]
- How to have content scroll over background
- 3 Level Deep Navigation Menu Not Showing All Levels
- Register sidebar ‘before’ and ‘after’ html as div rather than li tags
- WordPress Template Part in iFrame
- How can I change the theme of different posts using a plugin?
- Template for landing pages
- How to change the theme directory uri for localhost?
- Set a featured image as a replacement to the header image
- Replace site title with logo when logo is uploaded in customizer using
- Is it possible to have a theme that uses only one single page?
- Custom theme: How to call archive-post.php for viewing blog posts
- Will my site get messed up when the wordpress theme updates if I edited the html code in the editor to change footer?
- underscores use of the article element on the page template
- How to transfer one domain to another domain without losing theme options (customizer)?
- Plugin does not work in custom theme
- How to Have a Pure HTML Sub Directory In WP Site