Esta bien hecho un widget asi?
-
Tengo una duda sobre al crear un widget.
Yo estuve viendo un par tutoriales e hize aca solo un widget que muestre las entradas recien pero con imagenes al costado.class nuevo_finer_Widget extends WP_Widget { //setup the widget name, description, etc... public function __construct() { $widget_ops = array( 'classname' => 'nuevo-finer-widget', 'description' => 'Custom nuevo Profile Widget', ); parent::__construct( 'nuevo_finer', 'nuevo finer', $widget_ops ); } //back-end display of widget public function form( $instance ) { echo '<p><strong>No options for this Widget!</strong><br/>You can control the fields of this Widget from <a href="./admin.php?page=finer_nuevo">This Page</a></p>'; } //front-end display of widget public function widget( $args, $instance ) { $posts_query = new WP_Query( $posts_args ); echo $args[ 'before_widget' ]; if( have_posts() ): while( have_posts() ): the_post(); echo '<div class="media10">'; echo get_the_post_thumbnail(get_the_ID() , 'tab-small'); echo '</div>'; echo '<div class="media">'; echo '<div class="media-body">'; echo '<a href="' . get_the_permalink() . '" title="' . get_the_title() . '">' . get_the_title() . '</a>'; echo '</div>'; echo '</div>'; endwhile; endif; echo $args[ 'after_widget' ]; } } add_action( 'widgets_init', function() { register_widget( 'nuevo_finer_Widget' ); } );
Me refiero a la parte //front-end display of widget
Yo intente poner eso para que salgan los blog pero no se si es correctamente ponerlo asi.
El widget si funciona y muestra las entradas recientes con la imagen al costado.
Viendo 2 respuestas - de la 1 a la 2 (de un total de 2)
Viendo 2 respuestas - de la 1 a la 2 (de un total de 2)
- El debate ‘Esta bien hecho un widget asi?’ está cerrado a nuevas respuestas.