How to import the imagesLoaded and Masonry libs that come with WP in a Gutenberg block?

When developing a block with @wordpress/scripts, wp-scripts uses @wordpress/dependency-extraction-webpack-plugin to allow you to import dependencies from WordPress by replacing the import statements with references to the global variables loaded by the enqueued scripts. For example, this: import { useEffect } from ‘@wordpress/element’ Will become: const { useEffect } = wp.element; And wp-element will be added … Read more

Get the featured image of an ACF relationship field

According to ACF documentation, a foreach loop is to be used to access the items in a Relationship field. Untested: $templates = get_field( ‘field_61318c078a746’ ); foreach ( $templates as $template ) { $template_image_id = absint( get_field( ‘Image’, $template ) ); $template_image_url=”https://example.com/fallback-image.jpg”; if ( ! empty( $template_image_id ) ) { $template_image_url = wp_get_attachment_image_url( $template_image_id, ‘large’ ); … Read more

How to make a secondary Pages Screen

You’ll start with add_menu_page(), to create the actual admin page. From there, it’s really up to you, but I recommend using the WP_Posts_List_Table: nearly everything is built-in and ready to use. There are several comprehensive articles on creating a custom list table; most of them should be sufficient for getting you started.

wordpress multisite set up on localhost, redirects to live site

When moving a WordPress Multisite install to a different domain (such as from a live site to localhost), there are a few steps you need to follow to ensure that the site works correctly. These include updating the database and adjusting the wp-config.php file. Firstly, the DOMAIN_CURRENT_SITE in your wp-config.php file should not include ‘http://‘. … Read more

I want to force secondary rows using WP_List_Table

My recommendation is to structure the array so that your variations become “regular rows”. I would use your implementation of prepare_items for that. Here your array is changed to something like that: $this->items = array( array( ‘id’ => 2, ‘page’ => ‘page2’, ‘url’ => ‘page2’, ‘alt-id’ => null, ‘alt-title’ => null ), array( ‘id’ => … Read more

Make category page the wordpress homepage (not blog)

This happens because WordPress doesn’t have provide multi-lingual functionality by default. When you call get_category_link( 22 ), you’ll get exactly that – the link for category with the ID of 22. WordPress isn’t aware that there might be a translation for the term and it should be used instead. The multi-lingual support needs to come … Read more

Help with cPanel and sending email

Usually when I run into email sending problems, the solution is SMTP. You can set up a free account with SendGrid and install WP Mail SMTP. I believe SendGrid is a free option in that plugin as well. WP Mail SMTP has instructions on how to configure SendGrid. Once you’ve configured SendGrid and installed WP … Read more