0

I am trying to modify a theme by its child theme. The author already create a child theme.

I add many thing in the stylesheet, but it's not working. When I check in Developer mode. I see the link rel for stylesheet is https://.../style.css?ver=494

and style.css?ver=494 is empty

I think the functions.php that author made has some problem so I attach the functions.php (child theme) here:

<?php
// Exit if accessed directly
if ( !defined( 'ABSPATH' ) ) exit;

// BEGIN ENQUEUE PARENT ACTION
// AUTO GENERATED - Do not modify or remove comment markers above or below:

if ( !function_exists( 'chld_thm_cfg_parent_css' ) ):
    function chld_thm_cfg_parent_css() {
        wp_enqueue_style( 'chld_thm_cfg_parent', trailingslashit( get_template_directory_uri() ) . 'style.css', array( 'bootstrap','animate-css','carousel-css','fancybox-css','webkit-css','font-awesome-css' ) );
    }
endif;
add_action( 'wp_enqueue_scripts', 'chld_thm_cfg_parent_css', 10 );

// END ENQUEUE PARENT ACTION

I also attached the style.css (child theme) hereunder:

/*
Theme Name: Fitnesspoint Child
Theme URI: http://fitnesspointwptheme.staging7.in/fitnesspoint/
Template: fitnesspoint
Author: multidots
Author URI: https://store.multidots.com/themes/wordpress-themes/
Description: Fitness Point is an Wordpress template for health sports club, personal gym trainer, gym, gym shop and fitness websites. It is a highly suitable template for fitness companies as well as gyms or sports clubs. It has the purpose oriented design, responsive layout and special features like gym shop, services, courses, fitness plans and other pages.
Tags: custom-header,custom-background,threaded-comments,sticky-post,translation-ready,microformats,editor-style,custom-menu
Version: 1.8.3

*/

#primary-menu i.fa.fa-home {
    font-size:  20px;
}

section#huan-luyen {
    background-repeat: no-repeat;
    background-position: right;
    background-size: auto 100%;
}

.back-to-top {
    height: 130px;
    right: 25px;
}

Please help me!!!

P/S: I would like to have your ideas about changing the font in mysite. The theme fitnesspoint is using Latin-base Google Font. But my site is in Vietnamese. How to change it? Tnx

  • Sounds like you may need to clear your browser cache. – David Labbe Mar 6 '18 at 14:36
1

In the event a child theme is being used, this function will return the child's theme directory URI. Use get_template_directory_uri() to avoid being overridden by a child theme.

use : get_stylesheet_directory_uri()

Example code Here

<?php
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
  • Sorry... It not workd – Babelac Mar 7 '18 at 4:07
1

Simply use: get_stylesheet_directory_uri();

instead of get_template_directory_uri();

EDIT :

get_stylesheet_directory_uri(); function returns the URL to the current child theme, If a child theme is used. If you want to return the URL to the root/parent theme, use get_template_directory_uri(); instead. that's why it could solve the problem.

  • Please edit your answer, and add an explanation: why could that solve the problem? – fuxia Mar 6 '18 at 12:42
  • Sorry it not work. – Babelac Mar 7 '18 at 4:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.