Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter curiousjake

    (@curiousjake)

    Hi Ying,

    Perhaps some raw HTML? Or a backup post template block for when there are no posts? But even just some text saying ‘No posts found’ would be fine.

    Thanks,

    Thread Starter curiousjake

    (@curiousjake)

    Hi Carl,

    Great, thanks. So I need to have the Stocklevel setting checked to overwrite on both ‘Products to Zettle’ and ‘Products from Zettle’ so that stock syncs both ways?

    Thanks,

    Thread Starter curiousjake

    (@curiousjake)

    Awesome, thanks so much for your efficiency @hcabrera !

    Thread Starter curiousjake

    (@curiousjake)

    Hi @ejcabquina,

    Thanks for the response! I don’t think I explained properly. Using the filter above does add the font to the list, so I don’t think it’s a priority issue. The problem is that the filter isn’t applied when GP fetches font variants, so it isn’t possible to import the font variants from Google. The 'generate_google_fonts_array' filter, however, is applied in the function generate_get_all_google_fonts function, which is called by generate_get_google_font_variation:

    /**
    	 * Wrapper function to find variants for chosen Google Fonts
    	 * Example: generate_get_google_font_variation( 'Open Sans' )
    	 *
    	 * @since 1.3.0
    	 *
    	 * @param string $font The font to look up.
    	 * @param string $key The option to look up.
    	 */
    	function generate_get_google_font_variants( $font, $key = '' ) {
    		// Don't need variants if we're using a system font.
    		if ( in_array( $font, generate_typography_default_fonts() ) ) {
    			return;
    		}
    
    		// Return if we have our variants saved.
    		if ( '' !== $key && get_theme_mod( $key . '_variants' ) ) {
    			return get_theme_mod( $key . '_variants' );
    		}
    
    		$defaults = generate_get_default_fonts();
    
    		if ( $defaults[ $key ] === $font ) {
    			return $defaults[ $key . '_variants' ];
    		}
    
    		// Grab all of our fonts.
    		// It's a big list, so hopefully we're not even still reading.
    		$fonts = generate_get_all_google_fonts();
    
    		// Get the ID from our font.
    		$id = strtolower( str_replace( ' ', '_', $font ) );
    
    		// If the ID doesn't exist within our fonts, we can bail.
    		if ( ! array_key_exists( $id, $fonts ) ) {
    			return;
    		}
    
    		// Grab all of the variants associated with our font.
    		$variants = $fonts[ $id ]['variants'];
    
    		// Loop through them and put them into an array, then turn them into a comma separated list.
    		$output = array();
    		if ( $variants ) {
    			foreach ( $variants as $variant ) {
    				$output[] = $variant;
    			}
    
    			return implode( ',', apply_filters( 'generate_typography_variants', $output ) );
    		}
    	}

    Does that make sense or have I misunderstood?

    Thanks!

    • This reply was modified 4 years, 8 months ago by curiousjake.
Viewing 4 replies - 1 through 4 (of 4 total)