Create new recent testimonials widget in wordpress -
i have created new post type testimonials , portfolio. have created new widget areas,with this
register_sidebar( array( 'name' => __( 'testimonial sidebar', 'my-theme' ), 'description' => __( 'testimonial widgets area', 'my-theme' ), 'id' => 'sidebar-3', 'before_widget' => '', 'after_widget' => '', 'before_title' => '', 'after_title' => '', ) );i have created page sidebar-testimonial.php
, phone call them in single-testimonial.php
get_sidebar('testimonial');
now question is, how create widget "recent testimonials" same "recent post", dragging in 'testimonial sidebar' can display them in pages.
it real easy create own recent post widget.
here steps:
copy default recent posts widget core can found here.
add relevant code widget in functions.php , rename widget ever like
register new widget. see widget in backend
final customization here alter query within widget. need add together 'post_type' => 'your post type name',
query arguments on line 702 of link provided above
you can alternatively create utilize of filter provided , filter arguments of default recent post widget
wordpress
No comments:
Post a Comment