$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>theme development - Doing context-aware previews in the WordPress Customizer|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

theme development - Doing context-aware previews in the WordPress Customizer

matteradmin10PV0评论

Initially I was using active_callback to make my Customizer controls contextual in nature, and was satisfied with the kind product I had with it. But then I cam across this article about Content-aware previews in Customizer. It is awesome.

In that article, the author has used his own plugin to get the page value. I got everything from the JavaScript enqueued for the controls and the previews, what I didn't get is; what could be the page value for a post or a page or a custom post type here.

$page = Login_Designer()->get_login_designer_page();

Is anyone doing something similar with Customizer? Please share how this can be doable with the different page types.

Initially I was using active_callback to make my Customizer controls contextual in nature, and was satisfied with the kind product I had with it. But then I cam across this article about Content-aware previews in Customizer. It is awesome.

In that article, the author has used his own plugin to get the page value. I got everything from the JavaScript enqueued for the controls and the previews, what I didn't get is; what could be the page value for a post or a page or a custom post type here.

$page = Login_Designer()->get_login_designer_page();

Is anyone doing something similar with Customizer? Please share how this can be doable with the different page types.

Share Improve this question asked Aug 5, 2018 at 8:20 BheemsenBheemsen 7710 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

Since the code is using get_permalink( $page ), I would guess that $page holds an ID.

https://developer.wordpress/reference/functions/get_permalink/

In my opinion, it's not always a good thing to switch the preview to another page for the user.

Post a comment

comment list (0)

  1. No comments so far