I want to register a sidebar like this. I have register a widget with this code
register_sidebar(array(
'name'=>esc_html__('Main Sidebar', 'software'),
'id'=>'sidebar-1',
'description'=>'This widget is for Right Sidebar',
'before_widget'=>'<aside class="col-sm-3 right-part pr0">',
'after_widget'=>' </aside>',
'before_title'=>'<div class="col-sm-12"><h2>',
'after_title'=>'</h2></div>'
));
My html codes are
<aside class="col-sm-3 right-part pr0">
<div class="col-sm-12 sms p0">
<img src="images/sms-add.jpg" class="img-responsive">
<h2>Recommended</h2>
</div>
<div class="col-sm-12 apps p0">
<div class="col-sm-3 mb-img recommended p0">
<img src="images/window.png" class="img-responsive">
</div>
<div class="col-sm-9 recommended pr0">
<h4>Windows 7 mainstrem support ends</h4>
</div>
</div></aside>
So How can I do this. DO I need to register a custom widget? or there are any other solution?
Thanks in Advance.
yes you can also make your custom but follow this plugin it will so
https://wordpress.org/plugins/recent-posts-widget-with-thumbnails/
https://wordpress.org/plugins/flexible-posts-widget/
so from both of this you get output that you want.
**WITH OUT PLUGIN **
STEP -1
In your functions.php file, write the following code:
STEP -2 The form() method
very simple form with 2 fields: a text field for the Widget title, and a drop down list for the number of listings we want to show:
STEP – 3 The widget() method
STEP -4 Pull our Custom Posts
This method will do a query of our custom posts. It will only return the number of posts that weâve saved in our widget. Add this code to our class:
note here in above 4th step my post type is listing so i used it
you can set your own post type.
ex- you need to use like this
AND IN END once you get image and text then set your own css as per your design.