Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Installation/Upgrade Issues (http://forum.bytesforall.com/forumdisplay.php?f=58)
-   -   Child Theme - CSS loading Problem (missing wp_enqueue_style in atahualpa) (http://forum.bytesforall.com/showthread.php?t=24029)

extremecarver Jul 24, 2018 04:16 AM

Child Theme - CSS loading Problem (missing wp_enqueue_style in atahualpa)
 
Hi - I can get the child theme to work - but only partially!

The problem is that following the wordpress codex - I have to know the parent_style name, which is supposed to be found by looking for
wp_enqueue_style
name in the style.css file - however for Atahualpa this does not exist.

So how can I write the child theme style.css in order to get further css from child theme loaded?


I need this in order to have fonts awesome loaded locally, however right now it only works if I copy the fonts-awesome folder directly into atahualpa folder, not if I copy it into the child theme so it survives updates.


(referring to https://codex.wordpress.org/Child_Themes )

juggledad Jul 25, 2018 02:49 AM

Hi,
Can you give me details on what you have downloaded for FA, where you put it, what you put into a past/page to call the FA ICON.

I'll take a look, but it might not be till early next week. I have a son selling his house Friday, moving on Monday and they (he, his wife and two kids) staying with us with starting Thursday and the place is already a madhouse (grin)

extremecarver Jul 25, 2018 04:28 AM

I've downloaded Font Awesome v 4.7.0:
https://fontawesome.com/v4.7.0/asset...some-4.7.0.zip

and unpacked it and placed a folder called font-awesome into the main directory of the child theme - there it does not work, in the main directory of atahualpa itself it works.

I have in my child theme -

style.css:
Code:

/*
Theme Name: atahualpa Child
Theme URI: https://www.velomap.org/atahualpa2-child/
Description: Child Theme für atahualpa
Version: 1.0
Author: Felix
Author URI: https://example.com
Template: atahualpa
License: GNU General Public License v2.0
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain:  atahualpa-child
*/

/* You can start adding your own styles here. Use !important to overwrite styles if needed. */

and functions.php I'm a bit lost - because I can not fully do it according to wordpress codex - right now I have only:
Code:

<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}

/* You can add your own php functions and code snippets below */

// Fix Shortcodes Ultimate from Loading Font Awesome Remotely
wp_register_style( 'font-awesome', get_template_directory_uri() . '/font-awesome/css/font-awesome.min.css', false, '4.7.0', 'all' );
?>

because for the full solution I would need to know what to enter for parent_style - and I cannot find out what value is needed for Atahualpa

Code:

<?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' );
?>

Quote:

where parent-style is the same $handle used in the parent theme when it registers its stylesheet. For example, if the parent theme is twentyfifteen, by looking in its functions.php for its wp_enqueue_style() call, you can see the tag it uses there is 'twentyfifteen-style'. In your child code, replace the instance of 'parent-style' with 'twentyfifteen-style'

Without this value it will not load the css of the child theme folder except style.css file.

juggledad Jul 26, 2018 02:38 AM

Ok, I need to reproduce this in the main Atahualpa folder first so I download the file, unzip it and change the name from 'font-awesome-4.7.0' to 'font-awesome' and put it in the Atahualpa folder.

1) Anything else?

2) What do I add to a post/page to see it work?

3) do you have a URL pointing to where you actually are using it?

(up early and have some time to look at this)

extremecarver Jul 26, 2018 04:07 AM

well you need to create a child-theme - then put the font-awesome folder into the main atahualpa folder - that way it works.

It does not work however when the font-awesome folder is in the child-theme folder - because CSS files besides the styles.css are not loaded from there - as I do not know how to configure it with atahualpa (not sure if it even works with atahualpa - I guess it could work maybe using some not widely used functions?).


I use Font-Awesome together with Shortcodes Ultimate plugin:
https://wordpress.org/support/plugin...codes-ultimate

and due to GDPR legislation I want font-awesome to be loaded locally and not from netdna servers.


Font-Awesome is e.g. loaded here on my page:
https://openmtbmap.org/download/dem-relief-shading/

If you scroll down you see the yellow boxes that can be opened and closed. If font-awesome is not loaded correctly - instead of showing "-" and "+" icons to open/close the boxes - only an empty square will appear.


Code for that boxes with Shortcodes Ultimate installed:
Code:

[su_spoiler title="Some Title" style="fancy" open="yes"]

Content...

[/su_spoiler]


I also use some more adaptations via child-theme - but they are not css based or I put it in the style.css file which is loaded - so until now I did not notice child-theme does not fully work together with atahualpa.

juggledad Jul 26, 2018 06:06 AM

Try this,
1) Move the font-awesome folder to wp-content
2) go to ATO->Add HTML/CSS Inserts->HTML Inserts: Header and add in a link:
HTML Code:

<link rel="stylesheet" href="
https://openmtbmap.org/wp-content/font-awesome/css/font-awesome.min.css"
\>

and save it

Then test it out.

in my test I was able to add a
HTML Code:

<i class="fa fa-camera-retro"></i> fa-camera-retro
to a post and it shows fine. If this works for you, you won't need a child theme.

extremecarver Jul 26, 2018 11:39 AM

This works only partly - iz actually loads from wp-content - BUT also from https://netdna.bootstrapcdn.com
So something is missing now to tell wordpress to stop loading it from netdna.

If I then use a child theme too - it will try to load from both - atahualpa theme folder, and wp-content.

juggledad Jul 26, 2018 03:06 PM

did you remove the code you added to the functon node?

extremecarver Jul 27, 2018 11:09 AM

The code I added was only added to the child theme, which I now of course deactivated. So there is no more added code in functions.php

juggledad Jul 27, 2018 01:40 PM

If you ssend me PM with an admin ID/PW I'll poke about a bit. I might get a chance tomorrow morning before everyone gets up (I hope)


All times are GMT -6. The time now is 09:35 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.