$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'); ?>add action only if gallery shortcode attribute is equal to?|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)

add action only if gallery shortcode attribute is equal to?

matteradmin9PV0评论

I'm customizing the gallery shortcode. Now, when the user clicks on edit button as shown below:

We can see the gallery modal like below:

In the right sidebar, we can see the gallery settings. And I want to remove that settings. So, I am able to remove that. But the problem is that the settings would be removed everywhere.

What I want is if the shortcode attribute has some value then only remove the settings. For eg.:

[gallery myattr="true" ids="1,2,3"]
[gallery ids="5,7,9"]

Here, we have two gallery shortcodes written using code editor. After switching to the visual editor we can see the image like first in this post. When edit button is clicked for first gallery, it should remove the settings (because it has myattr="true") but when edit button is clicked for second gallery, it should not remove the settings (because it has no myattr).

Is this possible?

if(some_condition) {
  // remove the settings
}

Where, some_condition probably be using apply_filters('post_gallery',.., etc. If there's anyway, I would be thankful to you.

Post a comment

comment list (0)

  1. No comments so far