Archived topic
require get_template_directory() problem
9 replies · Started by Tesco on July 26, 2022
I'm calling this file in functions.php this way but is giving me an error
require get_template_directory() . '/functions/comment.php';
Any oyher way to do it on a child theme?
Hi there,
what is it you're trying to achieve ?
5 columns (in a row ou more rows) by query in different pages (blog, search, categories, homepage, etc.).
Hopefully I'm clear. If don't, please ask...
Hi Tesco,
We have a filter called generate_blog_columns to alter columns specific to a page.
For reference, see this article: https://docs.generatepress.com/article/using-columns-in-the-blog/#changing-the-number-of-columns
Hope this helps!
Sorry... I was replying to the wrong post,,, So, when I was asking "what I was trying to achieve", I gave the wrong answer.
I’m calling this file in functions.php this way but is giving me an error
require get_template_directory() . '/functions/comment.php';
My goal is to include the file in functions.php
Already tried to use the include
There’s no such comment.php file. Do you mean comments.php? Or did you create this new file in that directory?
new file where I wrote custom functions which I'm trying to include on the functions.php being separated for better organization
I see. I think get_template_directory() works for the Parent directory.
Try replacing
get_template_directory()
with
get_stylesheet_directory()
Let us know how it goes.
Perfect!
Calling get_template_directory() get's the files from parent theme, by using get_stylesheet_directory() it calls files from the child theme.
Thanks!
You’re welcome Tesco!