Forum Replies Created
-
AuthorPosts
-
ジョンジョンParticipant
Please tell me the code to add a term to the widget.
ジョンジョンParticipantIt is a very good plugin so please make it a widget that can be filtered by term.
ジョンジョンParticipantWidget to expand.
class WtiRecentlyLikedPostsWidget extends WP_Widget
class WtiRecentlyLikedPostsWidget extends WP_Widget
I want expend widget to taxonomy term.
ex…..
◎post type → post
◎post type → custom post type◎category → category_name
× category → termI want to be able to acquire terms
————————————————–
php7
wordpress4.9
Custom Post Type UI
————————————————–how to
1 functions.php overwrite
if can not
2 wti-like-post-widgets.php editジョンジョンParticipantwordpress@support.webtechideas.com
this mail??
ジョンジョンParticipant
Add this way to functions.php, but what is wrong?ジョンジョンParticipant<?php } public function add_taxonomy_dropdown_args( $cat_args ) { $cat_args['taxonomy'] = $this->taxonomy; return $cat_args; } private function get_taxonomies() { $taxonomies = get_taxonomies( array( 'public' => true, ) ); return $taxonomies; } } unregister_widget( 'WtiMostLikedPosts' ); register_widget( 'WtiMostLikedPosts_Taxonomy' ); } add_action( 'widgets_init', 'override_WtiMostLikedPosts' );
ジョンジョンParticipant<p> <label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>"><?php _e( 'Taxonomy:' ); ?></label><br /> <select id="<?php echo $this->get_field_id( 'taxonomy' ); ?>" name="<?php echo $this->get_field_name( 'taxonomy' ); ?>"> <?php foreach ( $taxonomies as $value ) : ?> <option value="<?php echo esc_attr( $value ); ?>"<?php selected( $taxonomy, $value ); ?>><?php echo esc_attr( $value ); ?></option> <?php endforeach; ?> </select> </p>
ジョンジョンParticipantpublic function form( $instance ) { parent::form( $instance ); $taxonomy = 'category'; if ( !empty( $instance['taxonomy'] ) ) { $taxonomy = $instance['taxonomy']; } $taxonomies = $this->get_taxonomies(); ?>
ジョンジョンParticipantadd_filter( 'widget_categories_dropdown_args', array( $this, 'add_taxonomy_dropdown_args' ), 10 ); add_filter( 'widget_categories_args', array( $this, 'add_taxonomy_dropdown_args' ), 10 ); parent::widget( $args, $instance ); }
ジョンジョンParticipantfunction override_WtiMostLikedPostsWidget() { class WtiMostLikedPosts_Taxonomy extends WtiMostLikedPosts { private $taxonomy = 'category'; public function widget( $args, $instance ) { if ( !empty( $instance['taxonomy'] ) ) { $this->taxonomy = $instance['taxonomy']; }
ジョンジョンParticipantcheck
wti-like-post-site.php// Getting the most liked posts $query = "SELECT post_id, SUM(value) AS like_count, post_title, post_author FROM <code>{$wpdb->prefix}wti_like_post</code> L, {$wpdb->prefix}posts P "; $query .= "WHERE L.post_id = P.ID AND post_status = 'publish'"; // Get the posts for specific post type if(isset($args['post_type']) && !empty($args['post_type'])) { $post_type = trim($args['post_type']); $query .= " AND P.post_type IN ('" . str_replace(",", "','", $post_type) . "')"; }
I want to know the code to add a taxonomy input form with this widget.
ジョンジョンParticipantchanged my plofile email..
http://support.webtechideas.com/forums/users/jonjon/ジョンジョンParticipantCan you get the latest version?
ジョンジョンParticipantchange email please check me
-
AuthorPosts