Insomnia88
Forum Replies Created
-
Forum: Developing with WordPress
In reply to: insert script (application(ld+json) from inside of action?Thanks for the answer.
The action is used by a plugin but it seems you are right. Since I don’t know better and cant’t find the order I guess it’s just initialised too late.
Now I use another work around where I insert the<script>
directly in the body (that’s where the plugin action does its magic)- This reply was modified 4 years, 9 months ago by Insomnia88. Reason: typo
Forum: Developing with WordPress
In reply to: insert script (application(ld+json) from inside of action?My goal is to place a
<script type="application/ld+json"></script>
with my json code in the head of a site.
When I say the anonymous function doesn’t work it means that there is no output in the head. In this case it’s not even rendered anywhere else.
I guess the special circumstance is that I am already in an (anonymous) function of anadd_action
hook and this function returns something that is mandatory.
The complete segment looks like thisadd_action( 'some_action', function( $content, $args ){ if ($some_condition) { add_action( 'wp_head' , function() { echo '<script type="application/ld+json">{"foo":"bar"}</script>'; }, 10 ); } return $content; }, 10, 2);
The first
add_action
works as it should.- This reply was modified 4 years, 9 months ago by Insomnia88. Reason: typo
- This reply was modified 4 years, 9 months ago by Insomnia88. Reason: further explaining
Forum: Developing with WordPress
In reply to: insert script (application(ld+json) from inside of action?Thanks for the reply.
As I stated I tried an anonymous function before and it doesn’t work.
The script I posted is missing an opening and closing tag because it’s a hacky/dirty way but it works.
wp_add_inline_script
simply wraps your code inside a<script type="text/javascript">
tag. That’s why I close it at the beginning and open it afterwards. So the rendered code looks like this.<script type="text/javascript"></script> <script type="application/ld+json">my_code</script> <script type="text/javascript"></script>
- This reply was modified 4 years, 9 months ago by Insomnia88. Reason: typo
Forum: Plugins
In reply to: [Lazy Loader] block lazyloading with serverside rendering?Thanks, that’s the solution!
Forum: Plugins
In reply to: [Lazy Loader] lazyload doesnt work with gutenberg/5.x?I am currently working on a local server but I could upload when I have the time.
I just found the error, I have customized markup and this seems to break your plugin.
I added the lazyload class and attribute to my block and now it works ??offtopic: I still wonder how you managed to replace the image. I tried using my “own” lazyloading mechanic with blazy.js but when I replaced the src of the image with a placeholder wordpress “destroyed” the code when saving/refreshing the page. Probably because it recognizes that the src didn’t match with the data-src or image id.
Forum: Developing with WordPress
In reply to: gutenberg change html attributes of custom blockHave you looked at the html code and the image I proved above? I want to change the width of the columns like it is shown in the image dynamically. I explained all of that above. Look at the code, look at the image. I can’t explain it any better, sorry.
This is no newbie but a more “advanced” question targeting the gutenberg block api and dynamically created blockes (by me).Forum: Developing with WordPress
In reply to: gutenberg change html attributes of custom blockYes that is what I want to do but you cannot change something with css if you can’t select it.
I can also do that as mentioned aove with the help of javascript. Because the wanted “real” wrapper (look at the comments) of the children has a id-attribute calledblock-xxx
. Though it should be possible to change that without using of javascript but jsx or orther built in functions instead.
An image can be found here: https://i.stack.imgur.com/nchpJ.png
If you want a live example look at the gutenberg bootstrap plugin – this is the behavior I want to achive (in the most clean way possible).- This reply was modified 5 years, 2 months ago by Insomnia88. Reason: typo
- This reply was modified 5 years, 2 months ago by Insomnia88. Reason: removed some text
Forum: Fixing WordPress
In reply to: gutenberg – Is it possible to programmatically remove a block?Okay but why? This seems kinda off topic.
But I solved this on my own. What I was looking for was theremoveBlocks(clientid)
functionForum: Plugins
In reply to: [Yoast SEO] Yoast SEO doesn’t workSame Problem here – following errors in console
ReferenceError: YoastSEO is not defined (wp-seo-post-scraper-1100.min.js:1:63145)
TypeError: u.select(…) is null (wp-seo-post-scraper-1100.min.js:5:18066)
ReferenceError: YoastSEO is not defined (wp-seo-post-scraper-1100.min.js:1:63145)Forum: Plugins
In reply to: [Yoast SEO] no seo options visibleSame – just waiting for solution
Forum: Fixing WordPress
In reply to: Gutenberg Block inner content for each child?I had an error in my concept, nothing about the code. Can be deleted.
- This reply was modified 5 years, 4 months ago by Jan Dembowski.
Forum: Developing with WordPress
In reply to: Gutenberg FormToggle example?Solved it my own. Somehow I have to write the
onChange
differently compared to aCheckboxControl
. Like this<FormToggle checked={ attributes.check_bigbox } onChange={ () => setAttributes( { check_bigbox: ! attributes.check_bigbox } ) } />
Nice to know but why do you write it on your website then?
Forum: Plugins
In reply to: [Ultimate Blocks - WordPress Blocks Plugin] Tabs not working for me?Wordpress: 5.2.3
Ultimate Blocks: 2.1.3I have reinstalled wordpress, the plugin, deactivated other plugins – nothing helped. But I still found the solution for my case. Thing is that I turned on error notifications in php for logged in users. If there is any output before the header, redirections usually doesn’t work but with gutenberg enabled (since 5.0) wordpress doesn’t even save the post at all. Maybe it has something to do with the rest api that is canceled for the same reason? If I deactivate gutenberg I can save posts even if there are “errors” – notices, warning etc.
So the error/notice is still there and caused by the tab system only – BUT if I disable the notifications I can save the post and it still works. Maybe this information helps you and others.
Forum: Plugins
In reply to: [Ultimate Blocks - WordPress Blocks Plugin] Tabs not working for me?Yes, I even tried most of the other blocks and they work like a charm. It is just the tabs.