How to use scss in wordpress theme?

WordPress core by itself doesn’t support SCSS, even though it is actually used in core development now. The issue with “plugin” type solutions to add such support transparently is that they rely on “ports” of preprocessors. SCSS is not natively developed for PHP, running it in such environment is only possible with third party re–implementations. … Read more

wp_get_archives() – Get CSS selector for current month

Put the following function in your functions.php function wpse_62509_current_month_selector( $link_html ) { $current_month = date(“F Y”); if ( preg_match(“https://wordpress.stackexchange.com/”.$current_month.’/i’, $link_html ) ) $link_html = preg_replace(‘/<li>/i’, ‘<li class=”current-month”>’, $link_html ); return $link_html; } And then add the following line just before calling wp_get_archives() add_filter( ‘get_archives_link’, ‘wpse_62509_current_month_selector’ ); You might also want to remove the filter after … Read more

Custom CSS In Admin Only For Certain Roles

Upon request I will write an answer using a function from a suggested answer for the similar question: How to target with css, admin elements according to user role level?. This function will output classes to the body element for all roles of the current user in the form role-XXXXX function wpa66834_role_admin_body_class( $classes ) { … Read more

How to move parent li to end of child ul

Since this is a stylistic change, and not looking to reorder the DOM for semantic reasons, I think the js solution wouldn’t be the best approach. Better to keep it in CSS, keeping the markup intact. Two ways to do it: Flexbox: #generalinfo{ display: flex; flex-direction: column-reverse; } CSS Grid: #generalinfo{ display: grid; } .cat{ … Read more