Add HTML tags after & before items excerpt/content


In this tutorial, you’ll see how to programmatically add HTML tags after & before the list items excerpt/content.

Edit the file “functions.php” of your theme/child theme and copy/paste the following code:

$default: The default value (empty).

$post_id: The ID of the post. Use it to get your post data.

$map_id: The ID of the map.

$listview: The current view. List view = listview. Grid view = gridview.

$latlng: The coordinates of the current post/location.

$permalink: The URL of the current post/location.

The following example, demonstrates how to add the excerpt inside P tag:

/**
 * Open the HTML tag(s) */

function cspml_html_before_excerpt($default, $post_id, $map_id, $listview, $latlng, $permalink){
   return '<p>';
}
add_filter('cspml_before_listing_excerpt', 'cspml_html_before_excerpt', 10, 6);

/**
 * Close the HTML tag(s) */
function cspml_html_after_excerpt($default, $post_id, $map_id, $listview, $latlng, $permalink){
   return '</p>';
}
add_filter('cspml_after_listing_excerpt', 'cspml_html_after_excerpt', 10, 6);

In the same context