<commit_before><?php

/*
 * THIS FILE REQUIRES TIMBER
 */

/**
 * latestPosts
 *
 * Retrieves $num latest news posts that are published
 *
 * @param int       $num  number of posts you'd like
 * @param int       $exclude  id of post to exclude
 * @return array    WP_Query
 */
function base_latestPosts($num, $exclude = false) {
    $args = array (
        'post_type'              => array( 'post' ),
        'post_status'            => array( 'publish' ),
        'pagination'             => false,
        'exclude'                => $exclude,
        'post__not_in'           => array($exclude),
        'posts_per_page'         => $num,
        'order'                  => 'DESC'
    );

    $query = Timber::get_posts( $args );
    return $query;
}

// Get the post object of the parent of this page<commit_msg>Amend Exclude exception to work correctly, add latestX function to retrieve any type of post type<commit_after><?php

/*
 * THIS FILE REQUIRES TIMBER
 */

/**
 * latestPosts
 *
 * Retrieves $num latest posts that are published
 *
 * @param int       $num  number of posts you'd like
 * @param array     $exclude  array of ids of post to exclude
 * @return array    Array of TimberPosts
 */
function base_latestPosts($num, $exclude = array()) {
    $args = array (
        'post_type'              => array( 'post' ),
        'post_status'            => array( 'publish' ),
        'pagination'             => false,
        'post__not_in'           => $exclude,
        'posts_per_page'         => $num,
        'order'                  => 'DESC'
    );

    $query = Timber::get_posts( $args );
    return $query;
}

/**
 * latestX
 *
 * Retrieves $num latest news posts that are published
 *
 * @param int       $num        number of posts you'd like
 * @param int       $post_type  post type to retrieve
 * @param array     $exclude    array of ids of post to exclude
 * @return array    Array of TimberPosts
 */
function base_latestX($num, $post_type = 'post', $exclude = array()) {
    $args = array (
        'post_type'              => array( $post_type ),
        'post_status'            => array( 'publish' ),
        'pagination'             => false,
        'post__not_in'           => $exclude,
        'posts_per_page'         => $num,
        'order'                  => 'DESC'
    );

    $query = Timber::get_posts( $args );
    return $query;
}

// Get the post object of the parent of this page
{'fraction_non_alphanumeric': 0.12052653229123818, 'fraction_numerical': 0.0, 'mean_word_length': 1.8611764705882352, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 22, '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': '7449784', 'n_tokens_mistral': 735, 'n_tokens_neox': 707, 'n_words': 221}