(Squarespace) How to change Portfolio pagination to p2

To change Portfolio Pagination from h2 to p2.

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);
    });
    
    h2.parentNode.replaceChild(p, h2);
});
</script>