nicholasrees
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: Customizer preview styles breaks on chromeI’m using PHP to generate the css because partials under wp_customize_manager you can simply throw in a function to the manager instead of having to enqueue js. Additionally you can write the entire customizer with only php, which seems obviously advantageous to me. I don’t quite understand the “why” question. Asking why I’m trying to do something doesn’t actually solve the issue I’m having.
You’re right that I copied the incorrect section, there indeed is a section defined ‘menu’ as seen in the control parameters. If this were my problem, then I wouldn’t be able to see the control, but that is not the problem I described. The problem I described is chrome breaking the style tags–for not only this tag, but all tags on the site.
The sanitize callback is for hex codes. I’m also using wp_customize_color_control, so yes the sanitize callback and the color control is supposed to be used together in this way. All my other controls use these functions together, and there is no problem there. Also, I can verify that the correct values for the background are being added into the style tag–only that chrome will not display them for some reason.
With respect to the boolean values, from PHP documentation on boolean values:
“To specify a boolean literal, use the constants TRUE or FALSE. Both are case-insensitive.”With respect to the anonymous function, I had trouble simply just passing in the function name to the render_callback. I don’t know what the issue was there, and in either case the wordpress theme handbook does essentially the same thing (albeit, passing a parameter into the function). I don’t see why modifying this would change my functionality.
And yes, that’s exactly what I want to do by the way. Take any background property already defined for #menu-item-8 and replace it with the value from get_theme_mod( ‘menu-item-8’ ).
Maybe you could check and see what is invalid about the style tag?
function menu_items_style() { return '<style id="menu-item-styles" type"text/css"> #menu-item-8 { background: #ff000; } </style>' }Also breaks styles when the partial is rendered. Everything loads into the html of the partial, and that exact style is inserted and still breaks everything. It doesn’t make sense.
- This reply was modified 5 years, 9 months ago by nicholasrees.
- This reply was modified 5 years, 9 months ago by nicholasrees.
- This reply was modified 5 years, 9 months ago by nicholasrees.
- This reply was modified 5 years, 9 months ago by nicholasrees.
Forum: Developing with WordPress
In reply to: Customizer preview styles breaks on chromeI forgot to add the code that actually defines the section where the menu-item controls sit:
$wp_customize->add_section( 'content', array(
'title' => 'Customize the content appearance',
'description' => 'Customize the content appearance here.'
)
);
Sorry for making such a long post, I don’t know how else to succinctly explain the problem.