(Squarespace) How to change Portfolio pagination to p3

To change Portfolio Pagination from h2 to p3.

You can use this code to Code Injection > Footer

<script>
document.querySelectorAll('.item-pagination[data-collection-type^="portfolio"] h2.item-pagination-title').forEach(function(h2) {
 const p = document.createElement('p');
 p.innerHTML = h2.innerHTML;
 Array.from(h2.attributes).forEach(function(attr) {
 p.setAttribute(attr.name, attr.value);
});
 p.classList.add('sqsrte-small');
 h2.parentNode.replaceChild(p, h2);
});
</script>