Get options
I tried to get the redux framework options and to echo them, but after 2 hours of seach I really don't understand how to output them...
For example I set this fields in my options file :
array( 'id' => 'favicon', 'type' => 'media', 'url' => true, 'title' => __('Favicon', 'redux-framework-demo'), 'compiler' => 'true', 'desc' => __('Upload a 16x16px jpge, png or gif image.', 'redux-framework-demo'), 'subtitle' => __('Add a favicon logo to your website. <br> The favicon is displayed on the browser tab of your website.', 'redux-framework-demo'), 'default' => '', ),
And I want to ouptut this option.
What is the way to output it?
I know that I need to do something like this:
<?php echo $options['favicon']?>
But I didn't find in the document where and how I defined my $options name and where and how I output my option name id in my template page?
I didn't understand the global declaration, where to to it, why and how...
I know that I'm not really great in php, that the reason I choose to use this framework, but near every wiki links of redux framework are missing... (and my english are also not enough good to clearly understand the instructions...)
I hope that someone can help me...
By the way, to set the options in the admin panel, it's very very simple and it's saving time.
Must add
then to output, code will be like
thank you for your answer.
I already tried this in my template file where I want to output the option like this :
`
`But it don't works.... I've got no error, but nothing is output (I tried without the if condition also to be sure that the option is defined...)
In my option setup framework I set the option name like this :
` public function setArguments() {
$theme = wp_get_theme(); $this->args = array( // TYPICAL -> Change these values as you need/desire 'opt_name' => 'mytheme', `
You're not using the field output properly: http://docs.reduxframework.com/redux-framework/fields/media
Thank you for your answer. But it still don't works with this :
`
`
Because you change your opt_name to this 'opt_name' => 'mytheme',. Use mytheme instead of redux_demo.
'
And PLEASE, read this. A basic understanding of PHP is required. If you don't have that, this will be very difficult for you. http://docs.reduxframework.com/redux-framework/getting-started/
Finally I get it works but without ['media'] with the cureent version on GitHub (v: 3.1.8) I'm really lost in the documentation, there is different versions of document with differents ways to get options.
<link rel="shortcut icon" href="<?php echo $mytheme['favicon']['url'];?>
By the way, the media upload option not take .ico image for the preview. It displays instead the default.png. ico file are images and I think it will be great if it will work in future update because of the favicon for example...
Yeah, those docs were supposed to be for the background. I updated them so they are now correct. Sorry. :)
I just tried the uploader with an .ico file, and it took. I think that it more of a how Wordpress is configured on your server issue (or a PHP config issue, I'm not sure which).
ok thank you for your help.
It's strange for the .ico. It doesn't display the .ico preview image (but the url is correct in the field an option) .Il works for all other kind of image format. In the preview image I've got the default image (http://localhost/wordpress/wp-includes/images/crystal/default.png) added instead of my .ico image. I will try online but near sure that will not change the problem.
Hi,
I just love this framework. So powerful and easy to use. Thank you for it! I too have the favicon issue in theme options: http://awesomescreenshot.com/0e92hy2bf2 Any thoughts?
Thanks!
As I said before, the file will upload and reside in your media. There isn't anything we can do about the render issue as the upload is Wordpress's, not ours.
Correct. Browsers don't support the ico format except for the iconbar. As a result you'll never see a preview unless a website shows you an actual image. It's something we can't control. Try opening an .ico file in your browser. It just doesn't work.
Thanks for your comment. That's strange because with SMOF, there wasn't any issue of displaying the icon in theme options: http://awesomescreenshot.com/0502hyuq21 The script doesn't take it and transforms it into a jpeg or png to display it. It's still .ico
The function looks like this: http://pastebin.com/Jn1wJ3mb
Thanks!
So, I took a look inside the "media" field and located this line:
echo '<img class="redux-option-image" id="image_' . $this->field['id'] . '" src="' . $this->value['thumbnail'] . '" alt="" target="_blank" rel="external" />';
Changing value['thumbnail'] with value['url'] seems to make the swap.
So, in my case, the line becomes:
echo '<img class="redux-option-image" id="image_' . $this->field['id'] . '" src="' . $this->value['url'] . '" alt="" target="_blank" rel="external" />';
Does this change brings any downwards that I have to keep an eye on?
Thanks!
did you try gif or png format?
I have favicon options also with default gif value that uses media upload
and its working properly..and indeed moving in both admin section and in firefox for live. http://ultimateliving.staging.wpengine.com/ http://awesomescreenshot.com/0f82hyv411
I never modify anything
uses default media upload
array(
'id'=>'ax_favicon',
'type' => 'media',
'title' => __('Favicon', 'alphax-framework'),
'mode' => false, // Can be set to false to allow any media type, or can also be set to any mime type.
'default'=>array('url' => AX_CONFIG_DIR .'images/icon.gif'),
'desc'=> __(''),
'subtitle' => __('Add/Upload Your Website Favicon here'),
),
Indeed, it works great with other image formats. My only concern was about the .ico format.
Here's another question: any easy way of using Google Fonts library without an API key? Maybe something like: instead of using the API key to connect the actual functionality to Google fonts, I use my API key to get the fonts object, I store the object in a file, as a variable and pass it to the actual functionality. Even if it's not an organic approach, I'm aware that not all servers can handle the Google request, breaking the typography of the theme. Therefore, a local solution will work well in these cases.
Thank you!
Sorry, but a Google API key is required to use Google fonts. That is their requirement, not ours. We subscribe to the K.I.S.S. principle with Redux. :)
Got it! Thanks!
Hi Kevin,
I just notice the issue with .ico extension also not displaying on preview as well as on saving and got this array result from that field
Array ( [url] => http://localhost/wp/wp-content/uploads/2014/03/prop.ico [id] => 71 [height] => [width] => [thumbnail] => http://localhost/wp/wp-includes/images/crystal/default.png )
I also tested it on http://demo.reduxframework.com/ and no preview also.
I've manage to display the preview though I can't assure I'm doing it correctly by adding some line on ReduxCore media field file field_media.js below line 60 and line 72 just before the 'else' statement
## below line 60
var extension = thumbSrc.split(".").pop();
## line 72 before else
else if ( extension == 'ico' /*(thumbSrc.indexOf('.ico') >= -1) == true*/ ) {
thumbSrc = attachment.attributes.url;
}
now i got this array ;)
Array ( [url] => http://localhost/wp/wp-content/uploads/2014/03/prop.ico [id] => 71 [height] => [width] => [thumbnail] => http://localhost/wp/wp-content/uploads/2014/03/prop.ico )
can you test it?
Thanks
Thanks very nice