Underscores Cannot recognize header.php and footer.php

Joy

(@joyously)

Last I looked at underscores, it doesn’t load any CSS file. It looks like your second two screenshots have no CSS applied.
We can’t debug your theme from a screenshot, though. You will need to work through it.
Have you read the Theme Developer Handbook?

Thank you so much. Yes, that sems to be the problem, but the thing is, Underscores does load the css file via

function cartabianca_scripts() {
	wp_enqueue_style( 'cartabianca-style', get_stylesheet_uri(), array(), _S_VERSION );
	wp_style_add_data( 'cartabianca-style', 'rtl', 'replace' );

	wp_enqueue_script( 'cartabianca-navigation', get_template_directory_uri() . '/js/navigation.js', array(), _S_VERSION, true );

	wp_enqueue_script( 'cartabianca-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), _S_VERSION, true );

	if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
		wp_enqueue_script( 'comment-reply' );
	}
}
add_action( 'wp_enqueue_scripts', 'cartabianca_scripts' );

Judging from the pink on the links in the theme’s sngle post, I gather it recognized some of it… I’ll recheck the whole code again and let you guys know!

EDIT: I looked at my header and footer files and, as you can see in the single.php screenshot, the footer is evidently different: it’s the standard Underscores one, rather than the Lorem Ipsum I customized myself, but it still retains some of the css I spcified, so it’s not strictly a CSS problem.

  • This reply was modified 1 day, 15 hours ago by juuhachigo.
  • This reply was modified 1 day, 15 hours ago by juuhachigo.

Joy

(@joyously)

Are you calling get_header() and get_footer() in single.php and archive.php?
And do those have the wp_head() and wp_footer() calls in them? (that’s where the scripts and styles are output)

When you say that you see the standard underscores footer instead of the one you customized, does that mean that there are two copies of the file? Are you making a child theme? Are you using a cache?

1) Yes, in both files.
2) Yup to that as well
3) I have tried modifying header and footer, so that I could use get_header() and get_footer(), and also tried using get_header('custom') and get_footer('custom') . Neither seemed to work.
4) No, I didn’t use a child theme and I honestly don’t know whether I was using a cache, but I managed to fix it and it did seem to be some kind of cache problem.
Apparently, WordPress wasn’t recognizing the various files as part of the theme, but I accessed the dashboard > Settings, updated the permalinks and it suddenly started working °_°. I’ve never seen anything like that before, ever.



Source link