Jacob Peattie
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: viewScript functions from dynamic block not availableAs you can see from the markup, the
viewScriptscript is deferred, which means that its not loaded immediately, and may not be available yet when the browser parses theonclickattribute.The solution is not to bind the click event using the
onclickattribute. Instead you should bind the event usingaddEventListenerin your script. This means that your script can still work while using the more performant loading method. Additionally, in most cases theonclickattribute will be stripped from your post content entirely for security reasons if a non-Administrator makes a change to the post, as they are usually not allowed to include JavaScript in posts.Forum: Fixing WordPress
In reply to: Why do we have to deal with this Styles?On top off that, I can enqueue about any style using classic
wp_enqueue_style.
But… not the _theme’s main style sheet_.
Is this perhaps connected to all this?
Are themes not allowed anymore to load their own styles?You absolutely can use
wp_enqueue_styleto enqueue your theme’s main stylesheet. What makes you think you can’t?Forum: Developing with WordPress
In reply to: Warning: call_user_func_array()The error is not in
class-wp-hook.php. The error is caused by usingadd_action()with a callback that doesn’t exist. The message appears inclass-wp-hook.phpbecause that’s where it’s trying to run the callback.The specific reason you’re seeing this error is that you have an extra space here:
add_action( 'wp_body_open', ' gtm_body_open', 1 );In front of
gtm_body_open. Remove that and the error should go away.It depends how you made the changes. If you made changes by editing theme files directly then those changes will be lost because updating a theme replaces all its files on update. Any changes made using the site editing interface are saved to the database, so they will not be lost.
Paragraph spacing is controlled by the padding and margins on each paragraph. In your CSS I can see that your theme is setting a bottom margin of 20px for each paragraph:
.page_content p { margin-bottom: 20px; line-height: 25px; }But then in Additional CSS you’ve added:
.site-main p { color: white; padding: 19px; }Since this adds 19px to the top and bottom you now have a total of 59px between paragraphs.
- This reply was modified 3 years, 5 months ago by Jacob Peattie.
You can link images in a gallery if you’re using the block editor. Once you have inserted the gallery you can click on individual images and use the Insert Link button in the block toolbar to add a link.
Forum: Fixing WordPress
In reply to: Problem with passing $_GET parametersWhat are the parameters you’re using? Certain parameters are reserved by WordPress and if you add them WordPress is going to try and use them itself to find posts and it will return a 404 if it can’t find any. If you’re using a reserved term the reason adding
$would work is because it’s changing the name of the parameter, eliminating this conflict. A list of reserved terms is available here.EDIT: In poking around your link I can see that you have registered a post type called “Artist”: https://diamaudix.com/artist/ Since
artisthas been registered as a post type using it as a parameter will cause WordPress to attempt to find an artist that matches the parameter value. Settingquery_vartofalseor some other value when registering the post type will address the issue.- This reply was modified 3 years, 9 months ago by Jacob Peattie.
- This reply was modified 3 years, 9 months ago by Jacob Peattie.
Forum: Fixing WordPress
In reply to: Option to update / auto-update plugins is missingThe option to automatically update plugins was only added in WordPress 5.5, so it’s not going to be available until you update WordPress itself.
Forum: Fixing WordPress
In reply to: CLS issue with should_load_separate_core_block_assetsI don’t believe you can. This hook allows you to only load CSS for blocks that are in use, but WordPress can’t know what blocks are used on any given page until the page has been rendered, at which point the stylesheets can be only be added to the footer. This is the trade-off.
Forum: Fixing WordPress
In reply to: Cannot redeclare wp_add_iframed_editor_assets_html()This can happen if an update doesn’t fully complete for some reason. The solution for this is to generally update WordPress manually. There’s a guide for that here:
https://ww.wp.xz.cn/support/article/updating-wordpress/#manual-update
Forum: Plugins
In reply to: [Automatic Alternative Text] Possible to assign Alt tags to existing images?Hi @ilovecake,
Thanks for checking out the plugin. The plugin doesn’t currently have features for getting alt text for existing images unfortunately.
Is this plugin still actively developed?
Not really, sorry, but I haven’t officially retired the plugin because as far as I’m aware it still works.
The main reason there hasn’t been any activity is simply a lack of time, but also because I have joined 10up since the plugin was released and 10up develops a similar plugin with similar features called ClassifAI.
Normally it would probably not be allowed for me to work on a plugin that ‘competes’ with a 10up offering (although both plugins are free) but I haven’t even had that conversation to be honest with you.
Additionally, because the plugin requires quite complex things to be configured in Microsoft Azure, the plugin was always going to have a poor UX for non-developers, so this limited my enthusiasm for the project.
All that being said, if you take a look at this commit on GitHub you can see the code I was working on to add a button to the media library for getting alt text for existing images, if that’s of any use to you: https://github.com/JakePT/automatic-alternative-text/commit/886f5cc43b79f97808752b333a39368dcc86f9d2
I had planned to release it but right around that time the tool/service I was using to deploy from GitHub to ww.wp.xz.cn went under and I never got around to setting up a replacement. I might at least get around to that one of these days.
Forum: Fixing WordPress
In reply to: PHP code error?Here:
function njengah _remove_default_sorting_storefront()There’s a space between
njengahand_remove_default_sorting_storefrontthat shouldn’t be there.Forum: Fixing WordPress
In reply to: add podcast from wordpress to GooglePodcastWithout a plugin it’s not going to be possible. The RSS feed generated by WordPress is not a podcast feed and doesn’t include any of the data needed by podcast service to serve your podcast. You’re going to need a plugin or third party service to generate this feed.
You’re not using
hide_emptyanywhere?Forum: Fixing WordPress
In reply to: Send API tokens via formYou probably can’t encrypt the token. If you did then OKTA would probably receive an invalid token and reject the request. The proper way to encrypt tokens in transit is to ensure you’re using an HTTPS URL for the request.
If you want to avoid exposing the token to the end user in plain text in the browser via the form HTML, then the best solution to that would be to handle the form submission in WordPress on your own server and on the server adding the API tokens before forwarding the submission on to OKTA. The problem is that this solution would typically require coding the form response entirely yourself, rather than using a plugin.
However there are services like Zapier where you could send the form to that service and then using their tools configure the service to send data to the OKTA API. That way you could keep the credentials on Zapier, without exposing them to the user.