Remove Redundant text when displaying titles within a loop

I have a loop that calls all my post titles of a CPT, each of with starts the the same X characters.

Example:

XXXXX Alabama

XXXXX Alaska

etc

How can I remove the ‘XXXXX’ so all that is displayed is:

Albama

Alaska

etc

Here’s my loop:

<?php
wp_reset_postdata();
$state_list = new WP_Query(array(
    'post_type' => 'play_states',
    'post_status' => 'publish',
    'posts_per_page' => -1,

));

while ($state_list->have_posts()) : $state_list->the_post();
    echo '<li><a href="'.get_permalink().'" class="' . $class . '">'.get_the_title().'</a></li>';
endwhile;
wp_reset_query();
?>

Thanks!

Read more here: Remove Redundant text when displaying titles within a loop

Leave a Reply

Your email address will not be published. Required fields are marked *