GeorgeGecewicz
Member
Posted 10 months ago #
Hey all,
I'm trying to run this code:
<h1><?php
$headidslug = bloginfo('name');
$headidslug = str_replace(" ", "", $headidslug);
echo $headidslug;
?></h1>
So that "Hey It's George" gets echoed as "heyitsgeorge", for example.
It's not working though, any ideas or solutions? Please forgive the PHP noobness.
use $headidslug = get_bloginfo('name');
and possibly add another line:
$headidslug = strtolower($headidslug);
http://php.net/manual/en/function.strtolower.php
GeorgeGecewicz
Member
Posted 10 months ago #
Thanks! This worked, I ended up using this:
$headidslug = get_bloginfo('name');
$headidslug = ereg_replace("[^A-Za-z]", "", $headidslug);
$headidslug = strtolower($headidslug);
echo $headidslug;
this would take "Hey It's George" and make it "heyitsgeorge", and removes all numbers and stuff too :)
Sweet!
This helped me!
Thanks!