diff --git a/class-category-sticky-post.php b/class-category-sticky-post.php index 74fbc60..231cc76 100644 --- a/class-category-sticky-post.php +++ b/class-category-sticky-post.php @@ -134,8 +134,8 @@ public function category_sticky_post_display( $post ) { wp_nonce_field( plugin_basename( __FILE__ ), 'category_sticky_post_nonce' ); // Get the category dropdown and the checkbox for displaying the border - $html = $this->get_categories_list( $post ); - $html .= $this->get_border_checkbox( $post ); + $html = '

' . $this->get_categories_list( $post ) . '

'; + $html .= '

' . $this->get_border_checkbox( $post ) . '

'; echo $html; @@ -383,22 +383,15 @@ private function get_sticky_query( $category ) { * @since 2.0.0 */ private function get_categories_list( $post ) { - - // First, read all the categories - $categories = get_categories(); - - // Build the HTML that will display the select box - $html = ''; - - return $html; - + $category_sticky_post = get_post_meta( $post->ID, 'category_sticky_post', true ); + + return wp_dropdown_categories( array( + 'echo' => false, + 'id' => 'category_sticky_post', + 'name' => 'category_sticky_post', + 'show_option_none' => __( 'Select a category…', 'category-sticky-post' ), + 'selected' => $category_sticky_post, + ) ); } /**