style one word in wordpress

Hi,

We are using a wordpress theme (Alexandria by theme alley) for a new site. We are wondering how to go about styling one word - the company name - every time it's used.

We read somewhere that we could add some code to functions .php but the answer wasn't long on instruction.

Our questions - is it possible and how?

Thanks
sio2yAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DzynitCommented:
This will work for the content area on your site. (then you can add styling for the class name "companyname" in your stylesheet)
For your widgets, it should be easy enough for you to just add the span tags in the widgets rather than use any type of function.

Add this to the functions.php file, but change the two "company name"'s to whatever yours is:
function add_companyname_class($content) {
	$content = str_replace('company name', '<span class="companyname">company name</span>', $content);
	return $content;
}

add_filter( 'the_content', 'add_companyname_class' );

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
sio2yAuthor Commented:
Awesome - thank you!

It will be a bit before we can add it but we will certainly be back with the results.
0
sio2yAuthor Commented:
To clarify - we just add this to the bottom of the functions php page correct?

Disregard - I saw the line after posting.
0
JavaScript Best Practices

Save hours in development time and avoid common mistakes by learning the best practices to use for JavaScript.

sio2yAuthor Commented:
Ok - That worked beautify on all the pages but the home page.

The reason is because this template is using a preformatted page layout - one of two. We placed the code into the .php page for that layout without success. It may be where we placed it. Is that something you can help with?

Thanks.
0
sio2yAuthor Commented:
Thanks.
0
DzynitCommented:
On your home page question, I'm not sure without seeing the code for it. No doubt it's set up with functions so you'd not be able to hook into like the code for the other pages. You'd probably be further ahead to just add those span tags around the company name in the page editor like I recommended on the widgets.
0
sio2yAuthor Commented:
Much appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
WordPress

From novice to tech pro — start learning today.