[wp-trac] [WordPress Trac] #36600: Selective refresh finds selected selector throughout the whole theme/site.
WordPress Trac
noreply at wordpress.org
Wed Apr 20 09:20:19 UTC 2016
#36600: Selective refresh finds selected selector throughout the whole theme/site.
--------------------------+-----------------------------
Reporter: helloguna1 | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.5
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello,
As I was updating a theme to use
`$wp_customize->selective_refresh->add_partial`, I noticed that if I were
to have a CSS selector of let's say `.portfolio-item`, it will not only
target the selector in the page that I'm viewing, but also everything that
has the same selector in ALL pages.
This causes it to go "white", refresh, and go "white" again depending on
how many items it has found with the selector.
The problem worsens as the callback function also applies to the items
that were not intended to be used on.
For example,
Option for Home page:
{{{
$wp_customize->selective_refresh->add_partial(
'section_portfolio_display_num_items', array(
'selector' => '.portfolio-items',
'container_inclusive' => false,
'render_callback' =>
'customize_partial_section_portfolio_items',
) );
}}}
Option for the portfolio page:
{{{
$wp_customize->selective_refresh->add_partial(
'portfolio_page_display_num_items', array(
'selector' => '.portfolio-items',
'container_inclusive' => false,
'render_callback' => 'customize_partial_portfolio_page_items',
) );
}}}
If I were to change `section_portfolio_display_num_items` setting, the
`.portfolio-items` in the Portfolio page will be refreshed by the
`render_callback` (of `section_portfolio_display_num_items`).
It this the intended result of selective refresh?
Thanks.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/36600>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list