WordPress.org

Ready to get started?Download WordPress

Forums

Easy Google Fonts
[resolved] Feature request (16 posts)

  1. Frumph
    Member
    Posted 5 months ago #

    The only way this plugin could be better (cause it's great right now) is if you can specify / remap the p,h1,h2,h3,h4,h5 to CSS elements you actually want to use.

    I found your filter for the p element and changed it to body; but to have it in the settings for it would be much better.

    https://wordpress.org/plugins/easy-google-fonts/

  2. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    Hi Frumph,
    Did you know that you can create custom font controls using this plugin? If you go to Settings > Easy Google Fonts you can create custom font controls and map any CSS element that you want to use.

    This setting was actually left out of the admin area intentionally because:

    1. The default control filters are there for theme developers that decide to integrate their theme with this plugin. This would allow a personalised theme customization experience for users without any knowledge of CSS.
    2. We didn't want to clutter the admin UI with alot of settings.

    Would you prefer the following feature instead?

    • One checkbox option to remove the default controls. This would then allow you to create as many custom font controls as you need for your theme as you see fit.

    Thanks for your feedback, it's great to hear your thoughts on it. One thing I am going to work on soon is some in-depth documentation as there are a lot of great things that this plugin can do that are not obvious to developers unless they dive into the plugin code.

    Sunny

  3. Frumph
    Member
    Posted 5 months ago #

    Well I recommend this plugin to people using my themes and they are definitely not tech savvy, so having them able to put in say body instead of p and .entry instead of one the h4 would be quite beneficial to them

  4. Frumph
    Member
    Posted 5 months ago #

    (however)

    If you wanted, .. to expand upon the filter you started with the P one, but also denote the change in the tab as well, I could add the filters into the themes to customize the plugin with specifics for the themes?

  5. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    Great, so it sounds like you're a theme developer that can benefit from integrating with our plugin. By registering the filters in your theme already you won't need to instruct every person using your theme how to add in body instead of p and .entry instead of the h4 it will just work automatically when they download and activate the plugin. Again, I will work on documentation for theme developers to help them get the best out of this plugin.

    Sunny

  6. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    When you say change in the tab do you mean the label of the font control?

  7. Frumph
    Member
    Posted 5 months ago #

    ^ Right, but the change also needs to modify the label name too ? it's currently not doing that

    (yes the font control label)

  8. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    Yes, the plugin is able to do that by hooking into the 'tt_font_get_option_parameters' filter. Let me give you an example of changing the paragraph label with code:

    function my_theme_edit_default_font_controls( $options ) {
        $options['tt_default_body']['title'] = 'Custom Paragraph Label';
        return $options;
    }
    add_filter( 'tt_font_get_option_parameters', 'my_theme_edit_default_font_controls' );
  9. Frumph
    Member
    Posted 5 months ago #

    and i'm going to have 6 of those functions inside my theme then going to have another 6 functions to filter the other ones like tt_default_body .. .. hrm.. little excessive, would be nice to do it in one swell swoop with a single filter

  10. Frumph
    Member
    Posted 5 months ago #

    Maybe with a custom add_theme_support section for it, where you can put those params, that'd be a great way of doing it

    http://codex.wordpress.org/Function_Reference/add_theme_support

  11. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    Also, please note that you can still add your own custom font controls already without coding at all! Log in to your WordPress admin area and go to Settings > Google Fonts

  12. Frumph
    Member
    Posted 5 months ago #

    You have a very good point ;)

    That will work fine, undoubtedly, i'll just write up an article so that people can understand what that means.

  13. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    No you wont have 6 functions. You will only need one. 'tt_font_get_option_parameters' allows you to change it all in one fell swoop already, here is an example of changing more than one label and modifying the selector:

    function my_theme_edit_default_font_controls( $options ) {
        // Paragraph label and selector
        $options['tt_default_body']['title'] = 'Custom Paragraph Label';
        $options['tt_default_body']['properties']['selector'] = 'p, .entry p .etc';
    
        // Heading 4 example
        $options['tt_default_heading_4']['title'] = 'Custom Heading 4 Label';
        $options['tt_default_heading_4']['properties']['selector'] = 'h4, #my-h4 #etc-etc';
    
        return $options;
    
    }
    add_filter( 'tt_font_get_option_parameters', 'my_theme_edit_default_font_controls' );

    Again I must stress that this is designed for modifying default controls and registering your own default controls. You are still able to create a font control in the admin by visiting Settings > Google Fonts

    Sunny

  14. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    Also, thanks for including our plugin in your top 15 on your website :) Just need to change that description after our chat on here ;)

    Sunny

  15. Frumph
    Member
    Posted 5 months ago #

    ^ that code is exactly what I need, thanks!

    and yeah; I will. heh didn't expect you to see that

  16. Sunny Johal - Titanium Themes
    Member
    Plugin Author

    Posted 5 months ago #

    haha I have eyes everywhere Philip ;) Glad I could help

    Sunny

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.