sprowt
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: escaping and translating clarificationhey BC ??
yes, you’re always helpful, thank you!
i’ll be sure to follow the directives in the link you sent.
have a great week <3
Forum: Developing with WordPress
In reply to: getting join() error with undefined $classes variablethat’s it, thank you!
after seeing it done in GP theme, i also cleared the
join()
error by passing the$classes
arg twice as tom does in his footer.php.a little digging paid off on that one.
as always, BC… i SO APPRECIATE your help and am really having fun with wordpress and php, thanks to you.
have a great weekend <3
Forum: Developing with WordPress
In reply to: getting join() error with undefined $classes variablei should also mention that i do get
class=""
in the html elements i use function but the actual specific class isn’t output.- This reply was modified 4 years, 1 month ago by sprowt.
Forum: Developing with WordPress
In reply to: getting join() error with undefined $classes variablethanks for your time, BC.
here’s my theme repo:
https://github.com/LGitHub-sprout/wordpress/tree/main/wphierarchy/app/public/wp-content/themes/wphierarchythere’s not much in it except the functionality i’m having trouble with, so there’s not a lot of digging involved ??
i get null on
var_dump( $classes );
/app/public/wp-content/themes/wphierarchy/index.php:26:null
i’m assuming the invalid join args is because $classes is null, and therefore neither a string nor an array of strings.
however, it is assigned in markup.php on line 30:
if ( ! function_exists( 'wphierarchy_create_header_classes' ) ) { add_filter( 'wphierarchy_create_header_class', 'wphierarchy_create_header_classes' ); /** * Adds custom classes to the header. */ function wphierarchy_create_header_classes( $classes ) { $classes[] = 'site-header'; } return $classes; }
other than that there’s not much to work back to.
what am i missing?? i’m stumped. unless this functionality is hooked into some other code in the the GP theme i’m not seeing/including.
thanks so much for your help!
Forum: Developing with WordPress
In reply to: getting join() error with undefined $classes variableForum: Themes and Templates
In reply to: [GeneratePress] generate_do_element_classesforgot to mark it solved
Forum: Themes and Templates
In reply to: [GeneratePress] generate_do_element_classesthank you, Tom <3
will def look into that.
i feel so lucky to be able to learn with GP and get a response to a Q.
truly grateful <3Forum: Developing with WordPress
In reply to: can’t get simple menu workinghaha thanks, BC!
perhaps you won’t believe it, but i’m actually from Denver, Lol. so, you’re psychic in addition to other talents.
i posted the solution and gave credit to @rup who helped me.
Be Well <3 !!
BIG thanks to stackexchange WP user, @rup for help!
“But if that’s actual content you want to render into the page then you don’t want to be requiring it like that from the top level of your theme file: maybe from inside a function that you then call from one of your page templates, probably header.php? If you are rendering out from the theme’s functions I could imagine that might break the theme customisation pages, yes.”
Rup Dec 16 ’20 at 22:19answered my own Q with @rup’s help.
rendering out directly from the required file was at least part of the problem.
i believe the other part was not rendering from inside a function as well as not hooking all of that functionality into an action in the target file.
the problem vanishes and the content renders properly when these steps are followed:
require the file in functions.php using built-in WordPress function to the current theme’s template directory as indicated above.
create a simple action hook in the target file using
do_action()
function:do_action( 'namespace_hook_name' );
create a (pluggable, if necessary) function in required file to render desired content (below is based on GeneratePress formatting). $priority and $accepted_args optional:
if ( ! function_exists( 'namespace_func_name' ) ) { add_action( 'namespace_hook_name', 'namespace_func_name', $priority, $args ); function namespace_func_name() { // code to render } }
search commercial themes for how they use action hooks as well as WordPress’s own default themes to learn more and practice.
https://developer.www.ads-software.com/reference/functions/do_action/
https://developer.www.ads-software.com/reference/functions/add_action/
Forum: Developing with WordPress
In reply to: can’t get simple menu workingi’m smh… yup, it was a typo :/
well, it happens to the best of folks, so i take it w a grain of salt.
i found an answer to this problem: https://www.ads-software.com/support/topic/cant-browse-themes-in-customizer-when-requiring-files-w-content/
should i post the solution, or does it matter?
thanks for your time, BC.
Forum: Developing with WordPress
In reply to: can’t get simple menu workingit works if i remove the
theme_location
fromwp_nav_menus
.now the ‘container_class’ and ‘container_id’ also work without the
theme_location
.why?
Forum: Themes and Templates
In reply to: [GeneratePress] require stmt jumbles elementthank you, @ejcabquina, for your reply.
when i require a file in my own theme like this:
require get_template_directory . '/path/to/file.php';
it breaks the <head> element and customizer as i describe above.
i thought i’d ask you since @wordpress won’t respond which really frustrates and disappoints me.
so much for the great wordpress support community ??
but GP is great and you guys always respond, no matter what.
so thanks for that.
Lester
update:
browser flashes the contents of the required file and then loads the requested page as i select customizer or when i navigate to the admin > themes.it flashes required file content on any page i try to navigate to.
for one particular install, i have neither plugins nor add’l themes (just 2017, 2019, 2020) installed that would conflict.
i have checked how the twenty-* themes require nested files and have copied and pasted the code, and the behavior persists.
Forum: Themes and Templates
In reply to: [GeneratePress] wp_body_open and //phpcs:ignore notationgot it, thank you, Tom <3
Forum: Themes and Templates
In reply to: [GeneratePress] header templates and wp_head hookyes, sir, those are the ones.
ok, so i think your response confirms that i’m cluing into code organization (as much as a guy like i can ;-).
it’s really cool how reading someone’s code gets you into their thought process.
i’m taking online course in building themes and plugins from scratch and using GP as an additional guide.
as always, Tom, much thanks and <3 for all you do for the community.