Support Forum

Please note that this forum is only available to you in read only mode. In order to contribute to this conversation you will need to renew your subscription.

where to paste the google font (in index.php template manager)

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

hi Paul
(or whomever it is who shall be reading those lines in this forum tonight or tomorrow):

<link href="fonts.googleapis.com/css?family=Baumans" rel="stylesheet">

<<-- I wish I could write in this font, can you quickly tell me
where in i need to paste this line into the index.php ?

joomla! tutorial tells me before /head,
but there'no 'head' in your template manager,

thank you
(waiting your answer before being enabled to continue in my website)
Nicole

: that's the line i am getting, there no head, see:


<?php
/**
* @package Xero 1.3.2
* @subpackage Updated: June 11 2015
* @author Joomlabamboo www.joomlabamboo.com
* @copyright Copyright (C) Joomlabamboo, June 11 2015
* @license www.gnu.org/licenses/gpl.html GNU General Public License version 2 or later;
* @version Xero - 1.3.2 | ZGF v4 1.3.2
*/

// no direct access
defined( '_JEXEC' ) or die( 'Restricted access' );

// Constant used to check for allow access in wordpress and J
define('ZEN_ALLOW', 1);

// Let the framework know we are in Joomla
// Define the framework we are in
define('WP', 0);
define('JOOMLA', 1);

// Set the Theme Name
define('TEMPLATE', basename(dirname(__FILE__)));

// SET the site root
define( 'ROOT_PATH', JPATH_ROOT);

// Set the theme path
define( 'TEMPLATE_PATH', JPATH_THEMES.'/'.TEMPLATE.'/');
define( 'TEMPLATE_PATH_RELATIVE', 'templates/'.TEMPLATE.'/');
define( 'TEMPLATE_URI', JURI::base() . '/templates/'.TEMPLATE);
define('FRAMEWORK_PATH', TEMPLATE_PATH.'/zengrid');


// Include main Zen Class
include JPATH_THEMES . '/' . TEMPLATE . '/zengrid/zen.php';

// Setup the params
$zen = new zen4();

// Check whether to load the mobile detect class
if($zen->params->mobile_detect) {
$zen->load_mobile_detect();
}

if(isset($zen->theme_files->child)) {
$child_layout= 'child/'.$zen->theme_files->child.'/default.php';

if(file_exists(TEMPLATE_PATH . $child_layout)) {
include JPATH_THEMES . '/' . TEMPLATE . '/'.$child_layout;
} else {
include JPATH_THEMES . '/' . TEMPLATE . '/tpls/default.php';
}
}
else {
include JPATH_THEMES . '/' . TEMPLATE . '/tpls/default.php';
} ?>
  • Nicole Beeckmans's Avatar
  • Nicole Beeckmans
  • 6 Month Developer
  • 46 posts
  • Karma: 0
The administrator has disabled public write access.
You should not add directly to the index.php, this bad practice in joomla generally.

JB templates enable google fonts to be added directly for most elements in the template admin under general settings > fonts

Here is the doc link for the section on fonts

docs.joomlabamboo.com/joomla-template/buildr-documentation/fonts

If you would rather add scripts to the head then the template allows this within the template admin.

Go look at the docs linked below or read the tips and information written by the develop within the template admin for that section

docs.joomlabamboo.com/joomla-template/buildr-documentation/settings/custom-scripts

Either method above will allow you to use google fonts within jb templates.

I noticed you post this in the buildr template section of the forum however show code from an older version of xero template. This uses an older framework version from a few years back. If you using this for some reason then the same principle can be applied but use these docs to help.

docs.joomlabamboo.com/joomla-template/xero/5_template-settings.html

I hope this helps you until support are online as it is the weekend.

Regards Ian
  • iafdesign's Avatar
  • iafdesign
  • LIfetime Developer - Big Bamboo
  • 393 posts
  • 153 Thanks
  • Karma: 58
Last Edit: 6 years 5 months ago by iafdesign.
The administrator has disabled public write access.
hi Ian,

in order to prevent errors:
can you tell me:

do i need to put the script "after opening head tag"
or "before closing head tags" ?

<link href="fonts.googleapis.com/css?family=Baumans" rel="stylesheet">

is the above line what will be understood by Build'r as a 'script' ??

thank you
best regards,
Nicole
  • Nicole Beeckmans's Avatar
  • Nicole Beeckmans
  • 6 Month Developer
  • 46 posts
  • Karma: 0
The administrator has disabled public write access.
Hi Nicole,

There is a fonts section in the buildr template

You shouldn't need to add any scripts to the scripts section

As Ian said

docs.joomlabamboo.com/joomla-template/buildr-documentation/fonts

This section covers how to add fonts to different parts of the site

So then it is a case of finding the font on the Google fonts website and adding to the relevant website field
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Have you tried adding to the fonts section and it hasn't worked?

If so what did you try adding?

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
paulus103 wrote:
Have you tried adding to the fonts section and it hasn't worked?

If so what did you try adding?

Cheers
Paul

hi Paul,
i just add:
<style>
@import url('fonts.googleapis.com/css?family=Baumans');
</style>

this in the template style > settings> 'After opening head tag' box

then i go to JCE Editor, and as recommanded on some of joomla!support forum found on search engine, as I could not find the 'Baumans' font listed, went to 'Components'> JCE Editor > Editor Global Configuration > Editor Style, changed from 'template' to 'custom css files' and in the box just below that: wrote "" templates/$template/css/editor.css ""
nothing happens when i go to JCE to edit my article, the font still not here. : when i click on button " Edit CSS Style " try to load the 'Baumans' font but i do not find it. --> can you help me in that please?

the other option of your documentation was to go into fonts in the designer tab, but it warns about possible : ""FOUT - flash of unstyled content. "" i don't want that!

can't i edit the index.php, even Ian says it's not recommanded, they seem to recommand it on the search engine.
(?)

thank you,
Nicole
  • Nicole Beeckmans's Avatar
  • Nicole Beeckmans
  • 6 Month Developer
  • 46 posts
  • Karma: 0
The administrator has disabled public write access.
Hi Nicole,

FOUT is a limitation of all external font libraries
e.g. there is a delay when a font is called and it loads from an external website

Embedded a font is not a particularly good idea either as this means loading large font files from the site

Getting FOUT depends on amount of external fonts loaded, what font is selected to load (size of font file varies), server performance of site / external library provider and website performance itself

Loading via the index file won't affect above it will still be loading a font from an external source

So I would definitely try loading fonts in the font section of the template first

Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
paulus103 wrote:
Have you tried adding to the fonts section and it hasn't worked?

If so what did you try adding?

Cheers
Paul

same, just for check's sake tried the first option by 'load' font (the one the docs warn about) 'on'
then
with this line in the settings:
<link href="fonts.googleapis.com/css?family=Baumans" rel="stylesheet">
did not work either in JCE Editor, not 'Baumans' font appears.
  • Nicole Beeckmans's Avatar
  • Nicole Beeckmans
  • 6 Month Developer
  • 46 posts
  • Karma: 0
The administrator has disabled public write access.
Regarding fonts it doesn't quite work like that

2017-11-06_02h51_09.png


This is a relatively simple font as it has one font weight and a single script type
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
Which means that heading tags have this particular font applied

2017-11-06_02h52_24.png


Cheers
Paul
  • manh's Avatar
  • manh
  • Moderator
  • 45248 posts
  • 2106 Thanks
  • Karma: 603
The administrator has disabled public write access.
The following user(s) said Thank You: Nicole Beeckmans

zentoolsIf you use Zentools please post a review at the Joomla! Extensions Directory.

Happy Campers