Add Plugins to WordPress Theme

Let me make a recommendation: do not bundle plugins with your theme! On first glance, yes this is a very easy way to add default functionality with your theme, but there are a slew of reasons not to include the plugins this way: Updates: If the plugin is freely available from WordPress.org already, then so … Read more

Edit srcset and sizes attributes in Gutenberg image, cover and gallery – blocks

Try the suggestion below: This assumes the <figure> element holding an image has a data-display-alignment attribute to match the alignment class applied attached that is somehow surfaced as a parameter in the wp_calculate_image_sizes hook: /** * Add custom image sizes attribute to enhance responsive image functionality * for content images. * * @param string $sizes … Read more

Need help setting default setting value for radio button in theme customizer

It is a long question but it is possible for some developers I would like to give this answer. Example: I have two choose for my home layout Grid and List and I prefer Grid is default choosing. I should add default value in add_setting simple like this ‘default’ => ‘grid’. $wp_customize->add_setting(‘yourtheme_home_layout_style’, array( ‘sanitize_callback’ => … Read more

Add a new checkbox in theme options

To answer the first part of your question: your settings form already has the checkbox case covered; so if you add a new checkbox input, you don’t need to add anything to the switch. This code will apply to all checkbox inputs you add: case ‘checkbox’: ?> <input type=”checkbox” name=”vertigo_theme_options[<?php echo esc_attr( $option[‘id’] ); ?>]” … Read more

Page template in two level deep folder

WordPress will only search one level deep (*See below for details) from the root directory of the theme for page (and post) templates. However, the array of templates can be filtered using the theme_{$post_type}_templates filter, so you can add deeply nested templates on your own: // See WP_Theme::get_page_templates /** * Filters list of page templates … Read more

Proper, exhaustive documentation for wp.editor etc

I have gone through the implementation of all Gutenberg core blocks in start, so now if I have to know how to use something then I first find the closest core component which is implementing that and then looks at the documentation of that particular block via https://github.com/WordPress/gutenberg/tree/master/packages/block-library/src This process is solving problems for me … Read more