alvaro05
Forum Replies Created
-
Ok, this should be the code, sorry for my confusion:
add_filter( ‘the_excerpt’, ‘shortcode_unautop’);
add_filter( ‘the_excerpt’, ‘do_shortcode’);But it is not working.
Forum: Plugins
In reply to: [Easy Google Fonts] Theme Default settings not savingThanks Sunny, I would really appreciate some help here as Im becoming a little bit crazy with this.
function aaa_egf_default_controls($options) { unset($options['tt_default_body']); unset($options['tt_default_heading_1']); unset($options['tt_default_heading_2']); unset($options['tt_default_heading_3']); unset($options['tt_default_heading_4']); unset($options['tt_default_heading_5']); unset($options['tt_default_heading_6']); $options['example'] = array( 'name' => 'example', 'title' => __('Post content', 'easy-google-fonts'), 'description' => __("Edit Font", 'easy-google-fonts'), 'properties' => array( 'selector' => 'body', ), 'default' => array( 'subset' => 'latin,all', 'font_id' => 'lobster', 'font_name' => 'Lobster', 'font_color' => '#333333', 'font_weight' => '300', 'font_style' => '', 'font_weight_style' => '', 'background_color' => '', 'stylesheet_url' => 'https://fonts.googleapis.com/css?family=Lobster', 'text_decoration' => '', 'text_transform' => 'none', 'line_height' => '1.4', 'font_size' => array( 'amount' => '15', 'unit' => 'px', ), ), ); return $options; } add_filter('tt_font_get_option_parameters', 'aaa_egf_default_controls');
I want to add default settings to my theme so:
1.When the user activates the theme and then the plugin, those default settings apply.
2.When the user goes to the theme customizer and selects Theme Default as font, those default values apply.Right now, when I add the code mentioned above,
1. This works perfect.
2.Maybe I am missunderstanding the scope of this snippet I added. I expected this default settings would apply (the same way as in 1.) when I selected “Theme Default” setting as font. However when selecting it, nothing is happening, the fonts is not loading and the selector is not applying.Forum: Plugins
In reply to: [Easy Google Fonts] Integrate EGF with theme?Sunny,
So I realized in a clean theme/plugin install, the above mention adds the fonts and selected options to the Customizer window. If I open the tab of one of them, the settings I defined are there. In the page the styles are applied correctly to the corresponding selector. However the font doesnt load (I can see this from Chrome developer tools). That is the issue Im having, if I change to some other fontfamily and back to theme predefined and save it works as it should.
Anything else I should be doing?
Pd. I also tried adding
‘stylesheet_url’ => ‘https://fonts.googleapis.com/css?family=Source+Sans+Pro:600’,
for example, with no luck
Thank youForum: Plugins
In reply to: [Easy Google Fonts] Integrate EGF with theme?Great, this is exactly what I was looking for. You are really helpful, Thank you very much for your time.
In the code you just posted in your last comment ‘text_transform’ => ‘uppercase’ is missing a comma after (for others interested).
Best,
AlvaroForum: Plugins
In reply to: [Easy Google Fonts] Integrate EGF with theme?I am trying to adecuate my theme so it can be used with this plugin. I already followed your code up to add my custom controls. What Im asking for is to give this controls a default value. Right now when the plugin is activated, the value for each option (Font Family,Font Weight/Style,etc.) is –Theme Default–. Which way do I assign this Theme Default value?
Thank you very much Sunny
Forum: Plugins
In reply to: [Easy Google Fonts] Integrate EGF with theme?Hi Sunny,
Thanks for this tip. Is there a way of assigning a “default” value to the settings?
AlvaroForum: Plugins
In reply to: [Easy Google Fonts] How to limit options availableNice catch the reset button.
Alright, I will go with this, thank you very much. Sure, Ill rate right now.Forum: Plugins
In reply to: [Easy Google Fonts] How to limit options availableSunny thank you very much for your answer.
I am creating a theme and wanted to recommend using this plugin. So I’m trying to integrate it correctly.
Thanks, Css is an option, but I wanted to know if there was a way of doing it with pure php (somewhere like bbb_egf_default_controls?). I don’t want the user to touch the css from the inspector, change some setting he shouldn’t and end up not knowing how to put it back (because it doesn’t appear). Anyway Ill try to check some workaround.Best
AlvaroForum: Plugins
In reply to: [Easy Google Fonts] How to limit options availableHi Sunny, great plugin ??
In relation to this, I was interested in removing positioning tab, which, to be honest, I dont really see margin,padding,display belong to the typography section/panel.
Is there any chance of removing it with php?
Thank you very muchForum: Fixing WordPress
In reply to: Add new data attribute into get_image_tag functionThanks to Pedro ghandi that answered my question here: https://wordpress.stackexchange.com/questions/60792/replace-image-attributes-for-lazyload-plugin-data-src
Here is my final code:
function add_lazyload($content) { $dom = new DOMDocument(); @$dom->loadHTML($content); foreach ($dom->getElementsByTagName('img') as $node) { $oldsrc = $node->getAttribute('src'); $node->setAttribute("data-original", $oldsrc ); $newsrc = ''.get_template_directory_uri().'/library/images/nothing.gif'; $node->setAttribute("src", $newsrc); } $newHtml = $dom->saveHtml(); return $newHtml; } add_filter('the_content', 'add_lazyload');
This inside functions.php
Thanks!
Forum: Fixing WordPress
In reply to: Add new data attribute into get_image_tag functionI see it now, thanks! Let me test it and if it works I’ll also post it here’
Forum: Fixing WordPress
In reply to: Add new data attribute into get_image_tag functionSorry, I don’t understand what you mean. I asked there too but there is no response yet..
Forum: Fixing WordPress
In reply to: Add new data attribute into get_image_tag functionA problem I am experiencing with alex20hz code is that it replaces every text where ‘alt’ is written with the src=”…”.
How can I solve this?
Forum: Fixing WordPress
In reply to: Add new data attribute into get_image_tag functionHey this is awesome, I have been looking for this for a while.
Just one tip,In this line:
$search = '/src\=\"([^\s]+(?=\.(jpg))\.\2)\"/';
I think the other image formats should be introduced, so my suggestion is:
$search = '/src\=\"([^\s]+(?=\.(bmp|gif|jpeg|jpg|png))\.\2)\"/';
Forum: Themes and Templates
In reply to: settings API dropdown list to select pageDid you end up with a solution?