<commit_before><?php 


/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since    1.0.0
*/
function wp_bottom_featured_bar_post() {
    global $post;
    // show only if the post type is a blog post
    if($post->post_type != "post")
        return null;

    $args = array( 'posts_per_page' => 1, 'orderby' => 'rand' ); 
    $rand_posts = get_posts( $args );

    return $rand_posts[0];
    
}<commit_msg>feat: include category parameter in filtering featured posts<commit_after><?php 


/**
* Define the core functionality of the plugin.
*
* Set the plugin name and the plugin version that can be used throughout the plugin.
* Load the dependencies, define the locale, and set the hooks for the admin area and
* the public-facing side of the site.
*
* @since    1.0.0
*/
function wp_bottom_featured_bar_post() {
    global $post;
    // show only if the post type is a blog post
    if($post && $post->post_type != "post")
        return null;

    // load categories 
    $categories = wp_get_post_categories($post->ID);
    $args = array( 'posts_per_page' => 5, 'orderby' => 'rand', 'exclude' => $post->ID ); 

    if ( $count = count($categories) > 0 ) {
       if ( $count == 1 && $categories[0] == 1) {
            // ignore the filter.
        } else {
            $args['category'] = implode($categories, ",");
        }
    }

    $rand_posts = get_posts( $args );

    return $rand_posts[0];
}
{'fraction_non_alphanumeric': 0.12646514497223935, 'fraction_numerical': 0.00863664404688464, 'mean_word_length': 2.8711217183770885, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '410709', 'n_tokens_mistral': 510, 'n_tokens_neox': 488, 'n_words': 179}