Retrieve alt text by referencing the img src

Did you get anywhere with this? I’ve just written a plugin that does exactly this job. It’s basically a cron job that scans all your posts & pages to create an internal index of which images are where. It then synchronises your Media Library alt text with the images in your content. It’s based on … Read more

Allow a user or role to view drafts and previews, but not other admin privileges?

Figured out an easier way. I gave them the edit_other_posts and edit_other_pages role capabilities, and then blocked their access to the admin area using the following: add_action( ‘init’, ‘eri_block_nonadmins_init’ ); function eri_block_nonadmins_init() { $current_url = eri_get_current_url( true, false); if ( (!current_user_can( ‘administrator’ ) && !( defined( ‘DOING_AJAX’ ) && DOING_AJAX )) && (is_admin() || $current_url … Read more

Tag title not being returned in page title of tag archives

I found my error. I had elseif ( tribe_is_upcoming() && ! is_tax() ) as a previous conditional, so that was getting applied to the tag pages before it got to the is_tag() conditions. Correcting this to elseif ( tribe_is_upcoming() && ! is_tax() && ! is_tag() ) allowed it to get to the is_tag() conditions.

Include custom fields in search

you can create your own search creating a file called search.php in your theme, there you can customize your search however you want. probably you already have a way to call it, however you can call it with get_search_form();

How to extend SelectControl with data from my theme

You can use wp_localize_script() to pass JavaScript variables to the editor: $asset_file = include(get_template_directory() . ‘/path/to/blocks/index.asset.php’); wp_register_script( ‘pb-theme-blocks’, get_template_directory_uri() . ‘/path/to/blocks/index.js’, $asset_file[‘dependencies’], $asset_file[‘version’] ); wp_localize_script( ‘pb-theme-blocks’, ‘pbThemeBlocksVars’, array( ‘classes’ => array(), // Your theme classes go here ) ); Then in your edit function: const classes = pbThemeBlocksVars.classes;