Brandon Payton
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: Image editor not workingHi @toby1kenobi,
This sounds like a strange issue. Are other instances of the images rendering properly, like the ones in the initial Add Media dialog?
If you have access to the Chrome browser, you can use the Chrome developer tools to see what is happening with the network request for the image that’s supposed to be in the Edit Image dialog. Here’s a short video showing how to check that:
In addition, if you’re able to install plugins, you can install and activate the Health Check & Troubleshooting plugin. It will add a Dashboard > Health Check link, and if you click on that, you’ll see a Health Check page with a number of tabs. Its Debug Information tab provides details about your setup that you can copy and paste here to help identify the cause of your issue. Clicking the “Show copy and paste” button reveals a text field with text formatted for this forum.
Forum: Plugins
In reply to: [Gutenberg] Exporting Reusable blocks from the Export ScreenHere’s a bit more info:
wp-admin/export.php
adds a radio button for each post type that is marked as exportable and not marked as builtin. Radio buttons for the builtin types for Posts, Pages, and Media are hard-coded.Unfortunately, the reusable block post type “wp_block” is marked as builtin, so it won’t get a radio button even if it is marked exportable.
There is a workaround though. If we use the code in my previous comment to mark the “wp_block” post type as exportable, we can manually enter the URL to download an export of just reusable blocks:
<domain-name>/wp-admin/export.php?download&content=wp_block
This is not a great solution but may get you where you want to go.
cc @noisysocks in case he’d like to correct or add anything.
Forum: Plugins
In reply to: [Gutenberg] Exporting Reusable blocks from the Export ScreenHi @nick6352683,
I experimented with enabling export for reusable blocks.
function srbe_support_reusable_block_export( $post_type_args, $post_type ) { if ( 'wp_block' === $post_type ) { $post_type_args['can_export'] = true; } return $post_type_args; } add_filter( 'register_post_type_args', 'srbe_support_reusable_block_export', 10, 2 );
With the above code, reusable blocks are included in exported content, but posts imported from the same export do not have their reusable block references preserved (i.e., editing one of these posts shows “Block has been deleted or is unavailable” where the reusable block should be). This was with exporting All Content. I’m not sure whether it is possible to export reusable blocks only but will explore this further and post if I learn more.
Forum: Developing with WordPress
In reply to: Gutenberg custom block: HTML does not unescapeThanks for you answer, will try and let you know. I can’t imagine this escaping being expected though, since the < character was escaped properly and the > character wasn’t.
@majorlabel, I wondered about this as well, and consistent with what @joyously mentioned, Gutenberg’s escape-html package explains that all we need to avoid are unescaped less-than characters and ambiguous ampersands:
https://github.com/WordPress/gutenberg/blob/3f23b1a69a1919b37c67f971cdf98112eb18b5e7/packages/escape-html/src/index.js#L71-L76I’m glad your issue is solved! Cheers!
Forum: Developing with WordPress
In reply to: Gutenberg custom block: HTML does not unescapeHi @majorlabel,
The escaping is expected behavior, but there is a RawHTML component that will allow you to save unescaped HTML.
Assuming it is part of your
save()
function, here is your last code block adapted to use RawHTML.el( "div", { className: "dishdetails__desc" }, el( wp.element.RawHTML, null, desc ) )
I believe that’s all you need to fix this case. Does that help?
Forum: Developing with WordPress
In reply to: Converting block and all nested children to HTML blockHi @willdelphia, here is the issue opened on GitHub:
https://github.com/WordPress/gutenberg/issues/13052Forum: Fixing WordPress
In reply to: How to allow .ged file uploadsI clearly missed your last post. ?? I’m glad you already have it working. Cheers!
Forum: Fixing WordPress
In reply to: How to allow .ged file uploadsHi @colinsp, I wanted to understand this area better and spent some time troubleshooting and reading upload-related code. I’m able to upload a
.ged
file if I add it as the “text/plain” MIME type:function gedcom_support_add_mime_type( $mimes ) { $mimes[ 'ged' ] = 'text/plain'; return $mimes; } add_filter( 'upload_mimes', 'gedcom_support_add_mime_type' );
This appears to be the PHP
finfo_file
function takes a look at the file and guesses it to betext/plain
. Then the detected type is compared with the type we registered for the file extension.I don’t know how
finfo_file
works, but maybe another MIME type would work if the platform is configured to recognize .ged as such.I hope this helps!
Forum: Everything else WordPress
In reply to: Latest Version of WordPress Instructional VideosHi @ballroom16, I’m sorry your experience has been difficult. I don’t know the reasons for all the changes but hopefully can provide a few things to help.
Where is the instructional video for learning how to use blocks to create a blog post?
I don’t believe there is an official video, but this video appears to be a pretty good overview of the new block editor and how to insert and configure blocks. It covers images and shows a menu you can use to insert other types of blocks, including lists.
Note: The user interface has changed a little since this video was made, but it still looks like a good intro.
Nor can I understand why the toolbar sometimes disappears, and I can’t get it back.
Are you referring to the toolbar that is shown above each block? If so, I think it is being hidden while you type so it doesn’t obscure your content. It is shown again when you move your mouse cursor.
Nor can I find the permalink or the link to switch from editing mode to code.
Here is a brief recording that shows editing the permalink slug:
Regarding the switching from visual editor to code, it is possible with the block editor, but when editing the code, it is good to be careful not to break the HTML for blocks or there may be issues to resolve after switching back to the visual editor. Here is a brief recording showing how to switch to the code editor:
Does this help?
Forum: Fixing WordPress
In reply to: Configurator for furnitureHi @gibtsdochned,
Since you looked for plugins, you may have already seen this, but this product configurator plugin appears close to doing what you mentioned:
https://www.ads-software.com/plugins/visual-products-configurator-for-woocommerce/I hope this helps.
Forum: Fixing WordPress
In reply to: OracleJDK | OpenJDKHi @teflonmerkel! I don’t believe this change should affect WordPress or your themes.
WordPress is not built on Java but rather with PHP, HTML, CSS, and JavaScript. PHP is a language that runs on the server, and HTML, CSS, and JavaScript are language read and run by the browser. Despite the fact that “JavaScript” contains the word “Java”, JavaScript is an independent language that does not rely on Java or its platform.
Does that answer your concerns?
Forum: Developing with WordPress
In reply to: Converting block and all nested children to HTML blockHi @willdelphia, it doesn’t look like that is currently possible with the block transforms API. A transform function is passed the block’s attributes only, so the transform doesn’t have access to inner blocks.
It seems very reasonable to want to transform a parent block, and doing so would naturally require access to inner blocks. I have to step away for the evening but will file an issue tomorrow if one doesn’t already exist.
Forum: Developing with WordPress
In reply to: How can I defer these JS files?Hi @webofpeace,
There appears to be a good plugin that provides this ability:
https://www.ads-software.com/plugins/async-javascript/There’s also an overarching optimization plugin by the same author:
https://www.ads-software.com/plugins/autoptimize/I don’t have personal experience with either of these, but perhaps they will provide what you are looking for.
Cheers!
Hi @mrshanemcdonald, I hope the following helps.
I included index as a ‘require()’, see below and I think because there is no actual page in the WordPress database for this page it could be causing an issue.
The path given to
require
in your example begins with a slash, indicating that index.php is located within the root/
directory. Instead, you can use the __DIR__ constant to provide a path relative to the current script’s directory. If your script is two directories above the current script, you might use something like the following:
require __DIR__ . '/../../index.php';
__DIR__ is the directory of the current file and is documented here.
..
represents a directory’s parent directory, so../..
refers to the parent of a parent.How do you use the get_the_ID() function if the page doesn’t actually exist.
get_the_ID()
returns false if there is no post, andget_post_meta
returns false if it does not receive a numeric post ID.Any tips on how to basically add the php functionality to the theme so the site has the following?
My Theme Header / My php script / My Theme Footer
The output of running your script will be included wherever it is required. If you’d like the output of your script to follow the header and precede the footer, you can require your PHP script somewhere after the call to
get_header()
and before the call toget_footer()
.Does this help?
Hi @sharewebdesign and @talldanwp, I played with this earlier today and wasn’t satisfied with what I was able to do using the
MediaUpload
component. I wanted something that would reflect the current featured image in the dialog, and to do that in a meta box, it seemed necessary to wrapMediaUpload
as a component connected to thecore/editor
wp.data store. The number of things this solution needed to duplicate Gutenberg behavior began to feel too high.Eventually, I settled on a hack where the meta box renders a hidden
PostFeaturedImage
component (the same that is used for the sidebar’s set-featured-image UI) and relays button clicks toPostFeaturedImage
buttons. It’s definitely a hack, but it works, is simpler to implement, and uses the actual dialog rather than one created to be substantially similar. A big downside is that it tightly couples us to the current implementation of the Featured Image UI.Here’s a gist with a tested proof of concept:
https://gist.github.com/brandonpayton/2c30c6175702adb12a093cf258d754d2- This reply was modified 5 years, 11 months ago by Brandon Payton.
- This reply was modified 5 years, 11 months ago by Brandon Payton.