Add HTML tags after & before items title


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

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 title inside H2 tag:

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

function cspml_html_before_title($default, $post_id, $map_id, $listview, $latlng, $permalink){
   return '<h2>';
}
add_filter('cspml_before_listing_title', 'cspml_html_before_title', 10, 6);

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

In the same context