no-thumbnail
MoonRocketStudio Recent Posts
Threads Started
18 posts
  • Exclusive Author
  • Has been a member for 1-2 years
MoonRocketStudio says

I searched everywhere on the web for some insight, and came up short so I figured someone here may guide me in the right direction.

Okay having an option panel is super cool, and pretty easy to implement. You call it in the functions.php and have your options.php page with all your arrays.

I am slowly getting good at PHP, but not quite there to get every task done, so I know it at a basic level, enough to create some cool things, but I am lost when I would like to add some arrays from the options in the back end to the front end, so when a user views the theme demo they have a few options to play with, like changing the layout from full to fixed. (I know my experimenting has gotten me close to a solution, but the more I try and guess a solution the more time I am wasting)

I have a floating div in my footer that holds all my HTML CSS, it would be nice to understand how to output some of those options into that HTML.

I hope my question is clear cut, and someone can answer the question, I would be so grateful.

Thanks in advance for your efforts.

1399 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

Hey,

I read your question but still am not sure so correct me if I am wrong,

you want to allow for frontend options editing?

no-thumbnail
MoonRocketStudio Recent Posts
Threads Started
18 posts
  • Exclusive Author
  • Has been a member for 1-2 years
MoonRocketStudio says

Hey,

I read your question but still am not sure so correct me if I am wrong,

you want to allow for frontend options editing?

Exactly I mean it’s a feature seen in many themes, so nothing new…

I just dont know the proper code to output it onto the front end…

For example array( 'id' => 'fixed-header', 'type' => 'switch', 'title' => __('Turn fixed header on or off', 'moon-opts'), 'desc' => __('Here you can choose if you want a fixed header or not.', 'moon-opts'), 'options' => array('1' => 'On','0' => 'Off'), 'std' => '1' ),

Here is an array with a switch button on/off how do I display that onto the front end?

64 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
CodeBotics says

As far as I know, most frontend options editing is done via jQuery/Javascript and only stays until you refresh the page. Basically the theme option is simulated to give a demonstration.

1399 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

As CodeBotics said, frontend options usually are for one time showcase and are not saved, but applied live as you change them.

If however for some reason you want to enable options changing on the frontend, you will have to study functions like update_option, get_option… Then you just create regular form, connect it to the php file that will process it and that’s it.

no-thumbnail
MoonRocketStudio Recent Posts
Threads Started
18 posts
  • Exclusive Author
  • Has been a member for 1-2 years
MoonRocketStudio says

Ah okay that puts me off into the right direction, thanks that is what I needed.

If anyone has anything to add then please do…

no-thumbnail
MoonRocketStudio Recent Posts
Threads Started
18 posts
  • Exclusive Author
  • Has been a member for 1-2 years
MoonRocketStudio says

I didn’t even think of that, it would cause chaos if a user changed something and it stuck…

It’s better off using jquery/javascript because it’s a lot better having it go back to defaults on refresh.

If anybody knows of any good posts about using jquery/javascript as a theme switcher, then please share a link!

64 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
CodeBotics says

It’s not too difficult to figure out for yourself if you have a basic grasp of jQuery. You can fairly easily do something like this using jQuery:

$('.myclass').click(function() { $('body').css('background-image', 'url(path/to/yourimage.png)'); });
no-thumbnail
MoonRocketStudio Recent Posts
Threads Started
18 posts
  • Exclusive Author
  • Has been a member for 1-2 years
MoonRocketStudio says

It’s not too difficult to figure out for yourself if you have a basic grasp of jQuery. You can fairly easily do something like this using jQuery: $('.myclass').click(function() { $('body').css('background-image', 'url(path/to/yourimage.png)'); });

Thanks, yeah I figured it out yesterday and all is well. I really appreciate your input because otherwise I would have kept looking for a PHP solution.

64 posts
  • Bought between 1 and 9 items
  • Exclusive Author
  • Has been a member for 1-2 years
CodeBotics says

No problem, glad to help!

by
by
by
by
by
by