How to remove p / br elements from gutenbergs editor
Possibly, try to wrap it in <pre></pre> tags.
Possibly, try to wrap it in <pre></pre> tags.
You are creating a cookie_checker function that returns the shortcode. However, the action you are hooking into (init), is executed too early (before the page content is created). You could instead try to “echo” the shortcode content in the footer of the page by hooking to wp_print_footer_scripts. An example I haven’t tested, but should work: … Read more
The problem you are facing is probably that the div (or a parent) gets re-rendered when a change is made in the DOM tree and the handler you assigned to it no longer works. This is because the element you see after the re-render is actually a new one which doesn’t have the handler assigned. … Read more
This was way simpler than I thought it was – even on post.php, you need to run wp_enqueue_editor() before using wp.editor in JavaScript. I had assumed that I wouldn’t need to do that, because an editor was already loaded.
This is very simple to achieve with JavaScript. Place this at the bottom of your page, just before </body> tag. This will append ?pp=my-affiliate-id at the end of your links. Just change the variable aid value below: <script> // Change “my-affiliate-id” below to your actual affiliate id const aid = ‘my-affiliate-id’; // Append slash with … Read more
And I’m wondering if I have to translate the array too if I want to make my plugin fully translatable. It wouldn’t be fully translatable if you didn’t, would it? So yes, you need to make these translatable for that to be true. In that case, it’s a good idea to use the new wp-i18n … Read more
There is is_404(). I normally use it to do just the opposite, to add CSS and JS animations which are specific to the 404 error page. In your case that would be: function wpse_339946() { if ( ! is_404() ) { wp_enqueue_script( ‘tracking-js’, get_template_directory_uri() . ‘/js/tracking.js’ ); } } add_action( ‘wp_enqueue_scripts’, ‘wpse_339946’ );
Made ajax call as a function to avoid the Console Error 400 Post. It opens the channel and I was able to get the parameters passed. counter.js jQuery(document).on(‘click’,’.counter’,function(e){ testAjax(the_ajax_script.ajaxurl); }); function testAjax(link) { $.ajax({ url: link, type: ‘post’, data: { ‘action’: ‘set_button_count’, ‘increase’ : ‘1’ }, success: function(data) { jQuery(‘.count’).html(data); } }); } In functions.php … Read more
This sounds like a timing issue, there is probably already some JS running after your script is ran. Try wrapping your JS in $(window).load(), this will run the function after other page assets have loaded and should fix the timing issue. For example… $(window).load(function() { document.getElementById(‘user_pass’).focus(); }); Here is some info about the difference between … Read more
I also can’t stand the fact the WordPress removes “javascript:void(0);” from my hrefs (or anything else TBH…) upon saving or using the visual editor. I just started using the Raw HTML plugin that does the job. I enclosed my code in [raw] … [/raw] codes, and did NOT use the visual editor. My “voids” remain … Read more