How can the PHP code be modified to only display the Div container if there are previous or next links available?

To only display the Div container if there are previous or next links available, we can check if the previous and next links exist before displaying the container. This can be achieved by adding an if statement to check if either the previous or next link is not empty, and only displaying the Div container if that condition is met.

<?php
// Check if previous or next links exist
if (!empty($previous_link) || !empty($next_link)) {
    echo '<div class="container">';
    // Display content inside the container
    echo '<p>Content goes here</p>';
    echo '</div>';
}
?>