• Resolved greenarrow

    (@greenarrow)


    I’m using the typography field in ACF option page & i’m calling it like this in <head> section.

    .navbar .navbar-top li a {
    font-family:<?php the_typography_field( 'main_navigation_font','font_family','option' ); ?>;	
    	

    the result is

    .navbar .navbar-top li a {
    font-family:Junge;	
    	
    }

    the thing is Google Fonts is not enqueued & not showing the correct font-family

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mujahid Ishtiaq

    (@mujahid158)

    @greenarrow Currently, Google Fonts are only enqueued to the front-end of pages and posts only.

    Thread Starter greenarrow

    (@greenarrow)

    @mujahid158 yes this is a frontntend issue. and im using a page. please help

    Plugin Author Mujahid Ishtiaq

    (@mujahid158)

    As per your code, it appears you are trying to fetch the font-family from ACF options page, is that correct? If so, the plugin doesn’t enqueue the Google Fonts if the font-family field is used from Options page.

    I suggest you to add the required fields in a new page and then use that page’s id in the function as described below;

    
    <?php 
    $page_id = 123; // change with yours page id
    the_typography_field( 'main_navigation_font','font_family', $page_id ); 
    ?>
    
    Thread Starter greenarrow

    (@greenarrow)

    @mujahid158 Without adding page ID i can get this

    .navbar .navbar-top li a {
    font-family:Junge;	
    	
    }

    Which is the font family i’m selecting in ACF option field is passed. i’m calling this style in <head> section of the page. so i want the styles to be there in any page. the thing is even the font-family correctly written to the CSS rule the main google font enqueue is not on the header section.

    this one.

    <link href="https://fonts.googleapis.com/css?family=FONTFAMILY&display=swap" rel="stylesheet">

    Plugin Author Mujahid Ishtiaq

    (@mujahid158)

    @greenarrow This plugin doesn’t enqueue selected Google Fonts FROM the options page. If you have used the Google font family in the ACF Options page, it’s CSS file is never enqueued. It is something I am currently working on. You can use the font-family anywhere in the theme, but without any font file enqueued.

    FYI, when you use a font-family from Google fonts on a post/page (not acf options page), the font file only enqueues on that post/page and not throughout the website.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Google Fonts not enqueued’ is closed to new replies.