Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #355229

    Hi guys,

    I try to connect files from child theme with parent theme. I need some files from folder */images and */lang from parent theme to be kept after updating the theme. So I created folders images and lang in child theme folder and put these files there.
    When I go to functions.php file in child theme and try to use this code my site crashes:
    require_once( get_stylesheet_directory(). '/lang/ru_RU.mo' );
    It doesn’t matter if I put .mo file or .jpg, anyway happens something wrong.
    What do I do wrong?

    #355376

    Hey!

    That may be happening because the file you are trying to include doesn’t exists in the server, i’d suggest using include instead:

    include( get_stylesheet_directory(). '/lang/ru_RU.mo' );
    

    Cheers!
    Josue

    #355674

    Hey Josue!

    Thanks for reply, however it didn’t work – same issue.
    Why do you think the file might not be on the server? I uploaded .mo and .po files into */enfold-child/lang folder. Style.css, functions.php and other php files included in child theme work correctly, but files like .png, .mo, .po etc don’t work.
    You can see the chaotic symbols on grey background above header. The more information in the file I try to include, the bigger this area.
    screenshot

    Best regards,
    Evgeny

    #355717

    Hi Evgeny!

    Can you translate that text? what does it say?

    Cheers!
    Josue

    #355843

    Hi Josue!

    This is just the small part of this text:
    ���DQl>�S �S*�S�STT�$TK�T5UIUZU \U fUrU wU �U �U�U �U�U �U6�U�UV8V >VHVYVbVHV4�V�V W WW0W AWHOW��WB=X�XE�X�X!�XY%Y>Y]YnY�Y�Y�Y%�Y �Y�Y ZZ2Z:ZRZgZ~Z�Z �Z �Z �Z�Z6�Z&�Z6″[ Y[d[�[“�[�[?�[\�\�\�\�\�\ ]] 1]>]G]Z] o]z]�]�]�]i�])^=^S^m^ ^0�^�^�^�^ �^�^__+_ >_ I_T_ Y_ c_ q_}_ �_ �_�_ �_�_ �_ �_ �_ �_�_ �%��a a"a 5aBa4Ra/�a��a�:bF�b9:ctc �c�c �c#�c)�c&d-d$Bd�gdWeFXe#�e+�e2�e%"f(Hf&qf#�f"�f'�f$g!,g>Ng!�g �g#�g)�g.hPMh�h�h�h�h�h!�h"i 7i Di Rii fiqi �i�i�i�i�i�i �i�i�i�i j jF$jkjsjB|j�j�j�j6 kDk#]k�k$�k%�k-�k5l9Pl�l&�l&�l&�l&m&Bm&im”�m�m�m�m nnn3n KnXnhnzn�n�n�n �n�n�nooo)o 1o?oNo ]oko {o �o �o�o�o�o*�op pp’p 6pBpUp^prpzp�p�p�p2�p�pqq2qGqq zq�q�q�q!�q�qVr#lr&�r,�r"�r8s8@sys�s&�s�s&�stt)tBt@Zt#�t$�t�tpuqu�u$�u,�u*�u*"vLMv��vB&w2iw(�wD�w" x.-xO\x�x$�xD�x,y�HA�A��Ḃ<��4L�,��p����c����5��7ӊ � ��.�3�L� T�b�q� ��+��'‹(��%�,9�#f����� �� �� �� �� Č Ҍ ܌ �� ��Y�,\����P�Wb���"Ԏ���� �� 3�?�T�8h�4��.֏�� /� ;�H� O� \�j� ~���=��������9�"U�x�1����ݑ ��X��KU����� �� ʒؒ�� ��� � �1+�]� b�yp����� ���.�=� M� Z� g� t����� �� ���� ���� Д۔����O�R�a�Hh�����ȕ ە ����3��+�e0�+�� – ϖږߖ��� �'� ;�F�]�b�e�l�/t��� ����#җ �� � ��0� H�$V�#{�m�� �"�&2�Y�)x�c��/�)6��e�l� ~��� �� ������ؚ �� ��� �+�/I�y�������֛����� �”�1� 6� D�Q� W�b� w�������”�7’�_�~�������ϟ���

    After these symbols there is text from translation in both languages:
    installed and activated successfully.%1$s installed successfully.« Older Comments(Edit)(It is recommended to only activate this if you receive spam from your contact form, since an invisible spam protection is also implemented that should filter most spam messages by robots anyways)(Note: Images will be scaled to fit for the amount of columns chosen above)(Show Styling Page)(Unnamed Slider).1 Columns1 Pixel Gap16:92 Columns3 Columns4 Columns404 – Page not Found404 Not Found4:35 ColumnsA list of all supported Video Services can be found on

    And then the symbols again.
    Though it started catching the files.
    I’ve noticed, that the symbols appear only if I login as admin

    #356289

    Hi!

    Why do you want to keep the ru_RU.mo file on the child theme folder? Is this for the Codestyling Localization plugin? You can simply add the lang folder on the child theme then include the language file that you want to preserve it in case you update the theme.

    Regards,
    Ismael

    #357156

    Hi Ismael,

    But this is exactly what I’m trying to do. I created lang folder in the child theme folder and put there language files.
    When I insert the codes from above into the child theme functions.php file, I see the mess in the header. Don’t understand why it happens, I do as wordpress codex and you guys tell me, but something goes wrong.

    Best regards,
    Evgeny

    #357166

    Ismael, I’ve actually seen the code you had posted before you deleted it. Is it correct?

    add_action('after_setup_theme', 'avia_child_lang_setup');
    function avia_child_lang_setup() {
            remove_action('after_setup_theme', 'avia_lang_setup');
            $lang = get_stylesheet_directory() . '/lang';
            load_theme_textdomain('avia_framework', $lang);
            var_dump($lang);
    }

    I tried this code, now it looks much better – only one line with error and the header sticked one line from the top when I scroll the page.
    This is the message I see above the header:
    string(76) “/home/e/evdubi/dubinchuk.com/public_html/wp-content/themes/enfold-child/lang”

    #357334

    Hi!

    Yes, I added it by I don’t think it will work on your end hat is why I deleted it. It should specify the lang folder on the child theme as main language folder. If it works, just remove this part:

    var_dump($lang);
    

    Best regards,
    Ismael

    #357410

    Thanks a lot, Ismael! It worked for me!
    Kriesi support is awesome!

    Regards,
    Evgeny

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘How to connect files from child theme with parent theme’ is closed to new replies.