Creating conditional blocks for WordPress Gutenberg

In the edit method for your custom block, when rendering the components you can use the “conditional + &&” pattern: <PanelBody title={ __( ‘My Panel’ ) } > { myCustomBool && <MyComponent value={theValue} onChange={ value => { myChangeCallback(value); } } /> } { ‘marmots’ !== myCustomThing && <MyOtherComponent value={theValue} onChange={ value => { myOtherCallback(value); } … Read more

How can I change the admin search posts fields?

It is possible, but you’ll have to play a little bit with the actual query. As always, the furious posts_clauses filter comes to action: function wpse_alter_posts_search( $pieces ) { global $wpdb; // Make the input save $search_string = like_escape( $_GET[‘s’] ); // Your new WHERE clause $where = $wpdb->prepare( “$wpdb->postmeta.%s LIKE %s”, ‘YOUR_COLUMN’, // Should … Read more

Linking Two Post Types

Scribu’s posts-to-posts is a great and simple plugin, I’m sure we can help you get it working. The basic usage is pretty straightforward. assuming your custom post types are named ‘place’ and ‘event’, the following code would go into your theme’s functions.php file: function my_connection_types() { p2p_register_connection_type( array( ‘name’ => ‘events_to_places’, ‘from’ => ‘event’, ‘to’ … Read more

Filter next_post_link() and previous_post_link() by meta_key?

I managed to get this working using nothing but WordPress filters, thanks to @Milo’s hint. Just note that these are pretty specific to my case but you shouldn’t have a problem modifying them for your own use. I am using Advanced Custom Fields with a Date Picker field called date and Prev/Next links only point … Read more