我需要向Divi子主题中的functions.php文件添加什么

我需要向Divi子主题中的functions.php文件添加什么,php,wordpress,fonts,themes,customization,Php,Wordpress,Fonts,Themes,Customization,我的问题是:我需要在Divi子主题内的functions.php文件中添加什么内容。 我想在Divi Builder中的“字体选择器”中添加一个新的Google字体(Varela Round) 我知道怎么做。所以这不是我的问题 1) 将“webfont”文件夹添加到Divi 2) 在header.php中,在结束head标记之前,我需要放置: <link rel="stylesheet" href="<?php echo $template_directory_uri; ?>/

我的问题是:我需要在Divi子主题内的
functions.php
文件中添加什么内容。

我想在Divi Builder中的“字体选择器”中添加一个新的Google字体(Varela Round)

我知道怎么做。所以这不是我的问题

1) 将“webfont”文件夹添加到Divi 2) 在header.php中,在结束head标记之前,我需要放置:

<link rel="stylesheet" href="<?php echo $template_directory_uri; ?>/webfonts/stylesheet.css" type="text/css" charset="utf-8">
以下一行:

$google_fonts = array(
'Varelda Round'             => array(
             'styles'        => '400',
             'character_set' => 'latin',
             'type'          => 'sans-serif',
    ),
当我在Divi主题中执行此操作时,我可以从我的Divi“字体选择器”中选择“Varela Round”字体

我现在陷入的困境是将所有这些翻译成我的Divi儿童主题

在我的Divi子主题中,我添加了“webfont”文件夹,其中包含我的字体

在Divi子主题中,我创建了以下两种结构

includes/builder/core.php

epanel/custom_functions.php 
我已经从父Divi主题中删除了
core.php
custom\u functions.php

我知道我仍然需要从我的子主题中更改
functions.php
中的某些内容,但这正是我被卡住的地方。我不知道我需要在子主题
functions.php

您可以在下面找到子主题
functions.php
文件,因为我已经进行了一些定制

    <?php
function enqueue_parent_styles() {
   wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' );
   //wp_enqueue_script( 'parent-script', get_template_directory_uri().'/js/main.js' );
}
add_action("wp_head","fun_head");
function fun_head()
{


 if (is_user_logged_in()) {

    global $current_user;
      get_currentuserinfo();
      $candi="none";
      $comp="none";
     if ( isset( $current_user->roles ) && is_array( $current_user->roles ) ) 
    {
        //check for admins
        if ( in_array( 'candidate', $current_user->roles ) )
         {
            // redirect them to the default place
            $candi="block";
        } 
        elseif(in_array( 'employer', $current_user->roles ))
         {
            $comp="block";
        }

    }


  ?>
<style type="text/css">

 #show_logut {
        display: block;
      }
      #show_myaccountcandi
      {
      display: <?php echo $candi; ?>;
      }
       #show_myaccountcomp
      {
      display: <?php echo $comp; ?>;
      }
       #show_login {
        display: none ;
      }
       #show_signup {
        display: none  ;
      }


</style>

<?php } 



else { get_template_part('ajax', 'auth'); 
//include('ajax-auth.php');
?>              
      <style type="text/css">
      #show_logut {
        display: none;
      }
      #show_myaccountcandi
      {
      display: none;
      }
       #show_myaccountcomp
      {
      display: none;
      }
       #show_login {
        display: block;
      }
       #show_signup {
        display: block ;
      }
      </style>
<?php } 

}

require_once(WP_CONTENT_DIR. '/themes/divichild/custom-ajax-auth.php' );
add_action( 'template_redirect', 'wpse8170_activate_user' );
function wpse8170_activate_user() {
    if ( is_page() && get_the_ID() == 25462 ) {
        $user_id = filter_input( INPUT_GET, 'user', FILTER_VALIDATE_INT, array( 'options' => array( 'min_range' => 1 ) ) );
        if ( $user_id ) {

            // get user meta activation hash field
            $code = get_user_meta( $user_id, 'has_to_be_activated', true );
            if ( $code == filter_input( INPUT_GET, 'key' ) ) {
               delete_user_meta( $user_id, 'has_to_be_activated' );
                update_user_meta($user_id,"activated",1);
                            $user = get_user_by( 'id', $user_id );
                            if( $user ) {
                            wp_set_current_user( $user_id, $user->user_login );
                            wp_set_auth_cookie( $user_id );
                            do_action( 'wp_login', $user->user_login, $user);
                            echo "Please wait until process complete.";

                                    //echo get_option("siteurl")."/mijn-account";
                                        wp_redirect(get_option("siteurl")."/mijn-account");
                                        exit();


                            }
            }
        }

        echo "<strong>Activation Key is wrong or expired.</strong>";
        die();
    }
}

function my_login_redirect( $redirect_to, $request, $user ) {
    //is there a user to check?
    if ( isset( $user->roles ) && is_array( $user->roles ) ) 
    {
        //check for admins
        if ( in_array( 'candidate', $user->roles ) )
         {
            // redirect them to the default place
            return get_option("siteurl")."/candidate-dashboard";
        } 
        elseif(in_array( 'employer', $user->roles ))
         {
            return get_option("siteurl")."/vacature-dashboard";
        }
        else
        {
            return home_url();
        }
    } 
    else
     {
        return $redirect_to;
    }
}

add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );

add_action('wp_logout','logout_redirect');

function logout_redirect(){

    wp_redirect( home_url() );

    exit;

}
?>

#展示{
显示:块;
}
#显示我的帐户
{
显示:;
}
#show_myaccountcomp
{
显示:;
}
#显示登录名{
显示:无;
}
#显示注册{
显示:无;
}
#展示{
显示:无;
}
#显示我的帐户
{
显示:无;
}
#show_myaccountcomp
{
显示:无;
}
#显示登录名{
显示:块;
}
#显示注册{
显示:块;
}

适用于任何需要此功能的人

解决办法相当简单

在子主题的functions.php中,只需添加以下内容

    // Add Custom Google Font
    function add_new_google_font($google_fonts) {
       $new_fonts = array(
          'Varela Round' => array(
             'styles' => '400,400italic,700,700italic',
             'character_set' => 'latin',
             'type' => 'sans-serif',
          ),
       );

   return array_merge($google_fonts, $new_fonts);
}

add_filter( 'et_builder_google_fonts', 'add_new_google_font' );
add_filter( 'et_google_fonts', 'add_new_google_font' );

给任何需要这个的人

解决办法相当简单

在子主题的functions.php中,只需添加以下内容

    // Add Custom Google Font
    function add_new_google_font($google_fonts) {
       $new_fonts = array(
          'Varela Round' => array(
             'styles' => '400,400italic,700,700italic',
             'character_set' => 'latin',
             'type' => 'sans-serif',
          ),
       );

   return array_merge($google_fonts, $new_fonts);
}

add_filter( 'et_builder_google_fonts', 'add_new_google_font' );
add_filter( 'et_google_fonts', 'add_new_google_font' );