Aslan French
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Changes to Gutenberg wp-image-block?@rwaynick Yes. I am starting with a brand new WP on AWS bitnami instance with default twentynintenteen theme running.
I have actually tracked down the source of the change in markup though and why it was changed. See github pull request and the discussion I’ve had with the dev who made the change there: https://github.com/WordPress/gutenberg/pull/7721
If you’re getting image block without the wrapper block that is probably the case of a center aligned or full width block. The wrapper block gets applied when blocks are loated left or right with alignright/left.
Forum: Fixing WordPress
In reply to: How do I include some custom Gutenberg blocks in a custom theme?I have tried adding the following code to my function.php and it should work but it does not seem to be.
I know the js and css files are all fine because the only thing I’m doing is copying the working plugin folder into my theme folder and then trying to enqueue the scripts from there.
add_action( 'enqueue_block_editor_assets', 'block05editor_scripts' ); function block05editor_scripts() { wp_enqueue_script( 'block05editor_scripts', get_stylesheet_directory() . '/Jackalope-Gutenberg/05-media-block/block.build.js', array( 'wp-blocks', 'wp-i18n', 'wp-editor', 'wp-components' ), '' ); wp_enqueue_style( 'block05editor_styles', get_stylesheet_directory() . '/Jackalope-Gutenberg/05-media-block/editor.css', array(), '' ); } //- ADD BLOCK ASSETS FOR FRONTEND add_action( 'enqueue_block_assets', 'block05frontend_styles' ); function block05frontend_styles() { wp_enqueue_style( 'block05frontend_styles', get_stylesheet_directory() . '/Jackalope-Gutenberg/05-media-block/style.css', array(), '' ); }
- This reply was modified 5 years, 5 months ago by Aslan French.
Forum: Fixing WordPress
In reply to: How do I include some custom Gutenberg blocks in a custom theme?@sterndata Sorry, I’m not asking about how to include ACF in my theme. I’m asking how to include Gutenberg blocks in my theme.
I made a plugin that registers custom gutenberg blocks.
I want to include it in my theme so that when the theme is install the blocks also become available without also having to install a separate plugin.
I am aware why this is not the recommended strategy by WordPress as it carries with the risk of theme lockin and making a website break content when the theme is changed.
But that’s not a concern in my use case and I am trying to make an install process more seamless. That’s my priority.
Thanks.
Some clarification as to why this have happened would be helpful but I’m going to go ahead and mark this as resolved.
switched it back to my old renamed url and tested it and now it works! I think it might just be that my cache plugin or something was interfering at first.
Hey @janwoostendorp
Thanks for replying. Does that just pick a random image from the media library or does it pick one from the post?
I had an array of images I wanted to use as filer backgrounds that were saved to my theme. I could also upload them, but wasn’t sure how the code you included here for the function.php file would work with it? Do I upload them and then specify the image ids in the code?
Hi, thanks so much for following up. I’ve actually moved to a different media file manager as the other one was giving me lots of problems even without reSmushit attached.
I’ve started using this one instead: https://codecanyon.net/item/wordpress-real-media-library-media-categories-folders/13155134
Do you guys support that one?
Hi, thanks so much for following up. I’ve actually moved to a different media file manager as the other one was giving me lots of problems even without reSmushit attached.
I’ve started using this one instead: https://codecanyon.net/item/wordpress-real-media-library-media-categories-folders/13155134
Do you guys support that one?
Awesome, I’ll check it out!
Forum: Requests and Feedback
In reply to: Why wordpress only use old jQuery version is 1.12.4?I’ve also always wondered this.
This is clearly not resolved and it would be good to have a better response from @wordpress
You could use conditional JSX statements in the save field. That’s basically what I did when I made my php version. I created a switch statement that tested to see what sub field was used and then changed the output html based on that. For Gutenberg you probably don’t have access to different subfield stuff, but I bet you could use javascript to check the file extension or maybe the MIME type. This might be of use:
https://www.jstips.co/en/javascript/get-file-extension/
Specifically you could maybe look into passing the file type information and storing it as an attribute. That might only store things on a per block rather than on a per gallery item basis. The per block attribute save would work for my experimental InnerBlock/ParentBlock solution but might not for yours since yours is just a block.
You might also set that information on file type as a css selector to be added on a per gallery item basis. Also I believe you can save stuff as data attributes though I haven’t looked at that a whole bunch yet.
I have a live version of my gallery on my portfolio website.
Here’s one that is photos and mp4s: https://www.jackalope.tech/case_study/lodestone-social-atomic-design-system/
Here’s one that is links to external pages: https://www.jackalope.tech/side_project/static-websites/
And here’s one where the lightbox brings up a sketchfab iframe for viewing 3D models: https://www.jackalope.tech/side_project/3d-models-and-shaders/
Also today I just finished doing a conversion of my custom media library to a Gutenberg block using the ACF beta. So it’s not a native implementation which I’m still hoping to do at some point, but maybe it can give you an idea of what I’ve done: https://github.com/jcklpe/Jackalope/blob/master/template-parts/blocks/mega-multimedia-gallery.php
This isn’t done the way you do things, but I honestly think most of the functionality I am looking for can just be handled by a custom Inner Block (container block, parent block. whatever the term is) importing the other native media blocks (so images and video in this case). After posting this I checked the Media Upload component documentation and there’s the ability to set a prop to
multiple: true
which allows you to select multiple things when the media uploader comes up. That seemed to me to be enough to do what I wanted, but when I make it true, I don’t see any change in my ability to select multiple objects in the media uploader.Aaaah, that makes sense. I guess I was thinking that a major release was a type of point release, haha. I didn’t know about the wp-cli thing though so I’ll keep that in mind. Running 5.0 now through the plugin though I really just wanted to hurry up and get on 5, rather than it be a matter of me wanting to specifically be in the beta group. I imagine that it wouldn’t be a good idea for my production website!
Oh sorry. Maybe I don’t understand point release as term then. I’m still pretty new to development. Thanks!
I understand you do it for free but that doesn’t change the issue that it has, which if you check back in on the support ticket, outlines how it is actually reSmushit that deviates from standard WP behavior (at least according to the Media Library Folders plugin author. )