Question

Is there a way to capitalize one word in a dynamic meta title?

Basically im using a slug in the meta title, but it is lowercase. I would like to capitalize just that one word, however im not sure the best way to do this?

<title><?php $taxonomy = 'propertytype'; $queried_term = get_query_var($taxonomy);$term = get_term_by( 'slug', $queried_term, $taxonomy ); echo $term->slug; ?> the rest of the thitle goes here</title>

Is there a method to capitalize the slug in the title?

Many Thanks

Paul

Was it helpful?

Solution

<?php
$taxonomy = 'propertytype';
$queried_term = get_query_var($taxonomy);
$term = get_term_by( 'slug', $queried_term, $taxonomy );
$cap = ucwords($term->slug);
?>
<title><?=$cap?>the rest of the thitle goes here</title>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top