duannei0044 2015-02-08 19:49
浏览 45
已采纳

WordPress儿童主题include_once

i'm trying to create a child theme to override some functions in my parent theme

i have this in parent functions.php theme

 include_once('admin/functions-extended/fn-typography.php'); //User Typography

This is my try:

  include_once(get_stylesheet_directory().'admin/functions-extended/fn-typography.php' );

but not work

more details

i'm trying add custom fonts in this file but in child theme the code in parent fn-typography.php is

function mgm_get_google_fonts() {
// Google Font Defaults
$google_faces = array(
    "Abel" => "Abel",
    "Abril Fatface" => "Abril Fatface",
    "Aclonica" => "Aclonica",
    "Acme" => "Acme",
    "Actor" => "Actor",
    "Adamina" => "Adamina",
    "Advent Pro" => "Advent Pro",
    "Aguafina Script" => "Aguafina Script",
    "Aladin" => "Aladin",
    "Aldrich" => "Aldrich",
    "Alegreya" => "Alegreya",
    "Alegreya SC" => "Alegreya SC",
    "Alex Brush" => "Alex Brush",
    "Alfa Slab One" => "Alfa Slab One",
    "Alice" => "Alice",
    "Alike" => "Alike",
    "Alike Angular" => "Alike Angular",
    "Allan" => "Allan",
            );
return $google_faces;
   }

i want remove this fonts and add another fonts

  • 写回答

2条回答 默认 最新

  • doucou1892 2015-02-08 22:29
    关注

    In the code you show, mgm_get_google_fonts() is not actually loading fonts, but apparently providing a list of fonts for some other function to load.

    The comment in the parent function describes it as providing defaults, so implies that there is some way to override them. From looking through the parent functions.php, you can probably figure out how you can do that.

    For example, if the parent theme allows you to override this function, it will probably say something like:

    if ( !function_exists( 'mgm_get_google_fonts') {
        ...the function definition you have above...
    }
    

    This tests to see if you have defined a function of the same name in your child theme and uses yours if you have.

    If the parent theme doesn't do this, they you will need to look where mgm_get_google_fonts is called and track down how to override.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥40 复杂的限制性的商函数处理
  • ¥15 程序不包含适用于入口点的静态Main方法
  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码