Jump to content

Recommended Posts

Hi,

 

I have a piece of code -

 

<?php echo $data['text_skill_one']; ?>

 

That is basically outputting an option from my Wordpress theme option panel, so the output from the above would be - HTML 5.

 

What I would like to do is make this output all lowercase with the spaces removed so we have - html5

 

The reason being that I would like to add it as a .class name in my php file.

 

The code I have attempted already is below -

 

<?php
$data = 'text_skill_one';
$string = $data;
$output = strtolower($str);
echo($string) ?>

 

But what this is currently outputting is - text_skill_one

 

I would like it to output the option that has been chosen in the Theme Options panel (lowercase with spaces removed)

 

Any tips would be greatly appreciated.

 

Thanks in advance

That thorpe meant is that your example code of what you want makes no sense at all, you say you want to echo a string lowercase with no spaces, then show how to access an array key using a key which is lowercase with no spaces, then show code which echoes the key (instead of using it as an array key) while simultaneously overwriting the array you showed in your first example.

That thorpe meant is that your example code of what you want makes no sense at all, you say you want to echo a string lowercase with no spaces, then show how to access an array key using a key which is lowercase with no spaces, then show code which echoes the key (instead of using it as an array key) while simultaneously overwriting the array you showed in your first example.

 

Thanks, please read my post a little more. I think I explain how I do not want to echo text_skill_one verbatim, but what text_skill_one outputs (a meta field), which will have the input HTML 5.

And you clearly already know how to do that.

Hi,

 

I have a piece of code -

 

<?php echo $data['text_skill_one']; ?>

 

That is basically outputting an option from my Wordpress theme option panel, so the output from the above would be - HTML 5.

 

Why you would attempt to alter the key string instead of the value in the array is the question.

You also overwrote your array.

 

 

Dan also GAVE you the answer already. What is the problem?

Edited by Jessica

There is no gentle or harsh tones in this thread, just a listing of facts. To understand the context of tech help fora a bit more, I recommend that you read this article. It'll also help you gain help more efficiently and accurately.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.