Ejemplo n.º 1
0
/**
 * Get the HTML for the excerpt in the grid
 *
 * @access   public
 * @since    1.0.0
 * @param    $post_id Int - The ID of the post to get the excerpt of
 * @param    $word_limit Int - The total number of words to include in the excerpt
 * @param    $read_more_text String - The ID of the post to get the title of
 * @return   $html_output String - A string holding the html for an excerpt in the grid
 */
function mp_stacks_postgrid_excerpt($post_id, $word_limit, $read_more_text = NULL)
{
    $the_excerpt = mp_core_get_excerpt_by_id($post_id);
    //Check word limit for excerpt
    if (!empty($word_limit)) {
        //Cut the excerpt off at X number of words
        $the_excerpt = mp_core_limit_text_to_words($the_excerpt, $word_limit);
    }
    //If there are 0 words in this excerpt
    if (mp_core_word_count($the_excerpt) == 0) {
        return NULL;
    } else {
        $output_string = strip_tags($the_excerpt);
        $output_string .= !empty($read_more_text) ? '<span class="mp-stacks-postgrid-read-more">' . $read_more_text . '</span>' : NULL;
    }
    $postgrid_output = mp_stacks_grid_highlight_text_html(array('class_name' => 'mp-stacks-postgrid-item-excerpt', 'output_string' => $output_string));
    return $postgrid_output;
}
Ejemplo n.º 2
0
/**
 * Get the HTML for the title in the grid
 *
 * @access   public
 * @since    1.0.0
 * @post_id  $post_id Int - The ID of the post to get the title of
 * @return   $html_output String - A string holding the html for a title in the grid
 */
function mp_stacks_postgrid_title($post_id)
{
    $title_html_output = mp_stacks_grid_highlight_text_html(array('class_name' => 'mp-stacks-postgrid-item-title', 'output_string' => get_the_title($post_id)));
    return $title_html_output;
}
Ejemplo n.º 3
0
/**
 * Get the HTML for the date in the grid
 *
 * @access   public
 * @since    1.0.0
 * @param    $post_id Int - The ID of the post to get the excerpt of
 * @return   $html_output String - A string holding the html for an excerpt in the grid
 */
function mp_stacks_postgrid_date($post_id)
{
    $the_date = get_the_date(get_option('date_format'), $post_id);
    $postgrid_output = mp_stacks_grid_highlight_text_html(array('class_name' => 'mp-stacks-postgrid-item-date', 'output_string' => $the_date));
    return $postgrid_output;
}