How to show associated fields if checkbox is checked in customize widget screen using wp_customize?

This is possible with JavaScript. You have to add an event listener to the checkbox and then show/hide the inputs depending on the checked state. Here is an example: checkbx = document.getElementById(“checkbox-id”) input1 = document.getElementById(“input1-id”) input2 = document.getElementById(“input2-id”) checkbx.addEventListener(“change”, () => { if(checkbx.checked){ input1.style.display = “block”; input2.style.display = “block”; }else{ input1.style.display = “none”; input2.style.display = … Read more

Theme.json: creating different sections of the color palette

No, writing as of WordPress 6.0 there is no API for defining additional palette sections. The colour palette component hardcodes 3 PaletteEdit sub-components, theme, default, and custom, where custom is for user defined colours. No dynamic fields or slotfills are provided for extending or adjusting these. Here is the current code: return ( <VStack className=”edit-site-global-styles-color-palette-panel” … Read more

Why don’t ‘wp_nav_menu’ CSS classes work until a menu is created?

This is due to the wp_nav_menu parameter fallback_cb: If the menu doesn’t exist, a callback function will fire. Default is ‘wp_page_menu’. Set to false for no fallback. You have not specified an alternative, so it uses the default, wp_page_menu. You could create your own function to display a page menu with the proper markup, or … Read more

Adding custom theme template to custom post type [duplicate]

File should be single-member_post.php instead of single-memberPost.php. In single-{posttype} , {post_type} is the $post_type argument of the register_post_type() function. Never use flush_rewrite_rules(); in init use it only on theme/plugin deactivate or activate. Since this is a theme you can use it on after_switch_theme hook. add_action( ‘init’, ‘my_cpt_init’ ); function register_cpt_member_post() { register_post_type( … ); } … Read more