Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sunny Johal

    (@sunny_johal)

    Hi,
    Thanks for starting a new thread. I’m not sure if you are aware but you can use this plugin to create custom font controls without coding.

    Example: Lets say I want to control a <h1> tag with the id site-title, here is what I would do:

    Instructions: Creating a custom font control for your site title:

    1. Log in to your WordPress admin area and go to: Settings > Google Fonts
    2. Click create new font control and give your font control a name e.g Site Title and click the Create Font Control button. (If no other custom font controls exist then it will take you straight to the add new control screen)
    3. Once you have created your new font control enter the following text in the Add CSS Selectors input box: h1#site-title (Press tab after each selector)
    4. Click the Save Font Control button
    5. Visit the customizer and you will see your new font control which will allow you to control the site title

    I hope that makes sense, if you still want to add !important suffix to each of the default controls please let me know and I will give you a code snippet to put in your theme. If you have any questions just give me a shout. Please let me know how you get on. Cheers

    Sunny

    Thread Starter WebTrooper

    (@webtrooper)

    Thanks for the quick response. I was exploring new font controllers but it does not address my question. I wish to add !important to the styles generated by EGF. In other words, I need

    ‘h1 {
    font-family: Poller One;
    font-weight: 400;
    font-style: normal;
    }’

    to be written as

    ‘h1 {
    font-family: Poller One !important;
    font-weight: 400 !important;
    font-style: normal !important;
    }’

    I’m assuming I would need to hack the code directly but I don’t know what code in what files I should be looking at. I’m pretty sure I can make it work if I just know where to look.

    Thanks

    Plugin Author Sunny Johal

    (@sunny_johal)

    Hi WebTrooper,
    No you wouldn’t need to hack any code in our plugin you can just add a filter in your themes functions.php file. Here is how you would do that (add this php function in your theme):

    function custom_egf_force_styles( $force_styles ) {
        return true;
    }
    add_filter( 'tt_font_force_styles', 'custom_egf_force_styles' );

    Sunny

    Thread Starter WebTrooper

    (@webtrooper)

    This works perfect. Thanks! ??

    Plugin Author Sunny Johal

    (@sunny_johal)

    Hi WebTrooper,
    My pleasure. As you have got it working I am going to mark this issue as resolved. Cheers

    Sunny

    A second thanks – I used this function as well!

    =Alan R.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to add !important to efg generated styles?’ is closed to new replies.