Home Forums Pro Themes  Travel Base Pro Registering New Google Fonts

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #140672
    Jade
    Participant

    Hey @support:

    Longtime user of WP Travel plugins and Travel Base Pro. Hope your team is staying safe.

    Theme: Travel Base Pro 1.0.9
    PLugins: Wp Travel 4.4 and WP Travel Utilities 2.1

    I’d like to register a couple of different Google Fonts, but digging around the functions.php file, I see that this theme approaches registering the fonts differently that I’ve seen before.

    On line 333 of the functions.php file, I adjusted it to the following:

    Before:

    if ( $fonts ) {
    		$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
    	}

    After:
    `if ( $fonts ) {
    $fonts_url = add_query_arg( $query_args, ‘https://fonts.googleapis.com/css2?family=Anton&family=Oswald:wght@300;400;500;600;700&display=swap’ );
    }`

    This however did not seem to register these fonts. Could you let me know how register new fonts correctly?

    Thanks!

    #140689
    Psink
    Keymaster

    Hello

    We all are safe here. Hope you too staying safe

    Regarding your query, i see there you have done little mistake during adding code in the theme. The way you have done to add font is not proper way. So we want you to send fonts name so that we could add it for you in the theme

    If you decided to add code yourself you can do just by following my instruction

    Add bellow code somewhere above line no. 324 in functions.php

    if ( 'off' !== _x( 'on', 'Raleway font: on or off', 'travel-base-pro' ) ) {
         $fonts[] = 'Raleway';
    }

    As you can see, the above code is for Raleway font. Just replace Raleway font name to font name you are trying to integrate.

    And also if you want to add font weight you can add weight as seen in below code

    if ( 'off' !== _x( 'on', 'Raleway font: on or off', 'travel-base-pro' ) ) {
    	$fonts[] = 'Raleway:400,500,600,700,800,900';
    }

    Regards,

    #140747
    Jade
    Participant

    @Psink:

    Thanks so much for the timely follow up, and for offering two solutions: to input the code change and how to input the change myself.

    Your instructions worked perfectly!

    You guys stay safe, and thanks again!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.