How to remove dashes from post name without PHP use

[ad_1]

I have this template code that stopped working because of PHP use:

<h3>Stories written:</h3>
[if stories_written]
<ul class="stories">
[each stories_written]
<li>
<?php $name_tr = str_replace('-', ' ', $obj->display('post_name'));
$name_tr = ucfirst($name_tr); ?>
<a href="https://projectdmc.org/support/topic/how-to-remove-dashes-from-post-name-without-php-use/{@permalink}"><?php echo $name_tr ?></a>

</li>
[/each]

</ul>
[else]
No stories found
[/if]

I have quickly changed it to:

<h3>Stories written:</h3>
[if stories_written]
<ul class="stories">
[each stories_written]
<li>
<a href="https://projectdmc.org/support/topic/how-to-remove-dashes-from-post-name-without-php-use/{@permalink}">{@post_name}</a>
</li>
[/each]

</ul>
[else]
No stories found
[/if]

It works now, but I have dashes in post names. Is there a way to remove dashes without using PHP?

Thank you

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer