Archived topic
update delete header.php stuff i putted
7 replies · Started by liorsade8 on January 2, 2018
hi,
i'm using generatepress theme and also child...
when i updated the generatepress theme it removed all my code in header (which was font face stuff)
what am i doing wrong?
i should have a child theme (which installed) that on it i will add stuff and once there is an update to core theme nothing will change... so where should i put the font face codes and other stuff i need instead the main header PHP file of the core theme?
http://a19121-tmp.s178.upress.link
(it's a test site)
thanks
Hi there,
Updates definitely don't erase modification you made in the child theme, you can imagine the complains we get by now :)
I think this hook is what you are looking for: https://docs.generatepress.com/article/wp-head/
no man... what i need to know is
where to put the font face code... in the main theme? or child?
now i'm putting it in the main theme in the header.php file
is there somewhere else?
inside the child theme?
this is the code for an example (with the entire generatepress header provided code for the header:
<?php
/**
* The template for displaying the header.
*
* @package GeneratePress
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?><!DOCTYPE html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="<?php bloginfo( 'charset' ); ?>">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<link rel="profile" href="http://gmpg.org/xfn/11">
<?php wp_head(); ?>
</head>
<style type='text/css'>
@font-face{
font-family:'avigul';
font-weight:700; /*(bold)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-bold-fm.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-bold-fm.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-bold-fm.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-bold-fm.ttf') format('truetype');
}
@font-face{
font-family:'avigul';
font-weight:400; /*(regular)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-regular-fm.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-regular-fm.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-regular-fm.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-regular-fm.ttf') format('truetype');
}
@font-face{
font-family:'avigul-shadow-fm';
font-weight:800; /*(shadow)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-shadow-fm.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-shadow-fm.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-shadow-fm.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/avigul-shadow-fm.ttf') format('truetype');
}
@font-face{
font-family:'almoni-neue-aaa';
font-weight:400; /*(regular)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-400.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-400.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-400.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-400.ttf') format('truetype');
}
@font-face{
font-family:'almoni-neue-aaa';
font-weight:700; /*(bold)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-700.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-700.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-700.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-aaa-700.ttf') format('truetype');
}
@font-face{
font-family:'almoni-neue-tzar-aaa';
font-weight:700; /*(bold)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-tzar-aaa-700.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-tzar-aaa-700.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-tzar-aaa-700.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/almoni-neue-tzar-aaa-700.ttf') format('truetype');
}
@font-face{
font-family:'atlas-pro-aaa';
font-weight:500; /*(regular)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/atlas-pro-aaa-500.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/atlas-pro-aaa-500.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/atlas-pro-aaa-500.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/atlas-pro-aaa-500.ttf') format('truetype');
}
@font-face{
font-family:'mikhmoret';
font-weight:400; /*(regular)*/
font-style: normal;
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/mikhmoret-regular-aaa.eot');
src: url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/mikhmoret-regular-aaa.eot#iefix') format('embedded-opentype'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/mikhmoret-regular-aaa.woff') format('woff'),
url('http://a19121-tmp.s178.upress.link/wp-content/themes/generatepress/fonts/mikhmoret-regular-aaa.ttf') format('truetype');
}
</style>
<body <?php generate_body_schema();?> <?php body_class(); ?>>
<?php
/**
* generate_before_header hook.
*
* @since 0.1
*
* @hooked generate_do_skip_to_content_link - 2
* @hooked generate_top_bar - 5
* @hooked generate_add_navigation_before_header - 5
*/
do_action( 'generate_before_header' );
/**
* generate_header hook.
*
* @since 1.3.42
*
* @hooked generate_construct_header - 10
*/
do_action( 'generate_header' );
/**
* generate_after_header hook.
*
* @since 0.1
*
* @hooked generate_featured_page_header - 10
*/
do_action( 'generate_after_header' );
?>
/**
* generate_inside_container hook.
*
* @since 0.1
*/
do_action( 'generate_inside_container' );
You should never add or modify any of main theme's file - they will get erased.
Take a look at this: https://docs.generatepress.com/article/adding-custom-font/
ok
so what i'm asking and u'r not answering is,
where should i put the code of the font face?
inside the child theme. ok. but where?
the child theme has: style.css and functions.php
so where? inside one of them?
i dont want to use any plugin. but only code.
It would be style.css.
You can see from your code above that it's wrapped in <style type=’text/css’> </style> and the link I provided suggested that it's CSS.
ok
got it! it's working! thanks.
so everything i need is only to do on the child - that's why it was created :) right?
Yup exactly :)