How to make elements not editable in visual editor

I have bootstrap grid in some pages, which I've made visibale in the editor by styling in editor styles. Is there a way to make the column div not removable in visual editor, kind of like how you can't delete a table cell with a backspace. So that when a client deletes the text in a div and keeps pressing the backspace it wont delete the div itself? However I do want the code to be editable when you switch …
Category: Web

How to restore visual editor in WordPress

I am running WP Multisite in version 4.8 I have a site in the network that lost the visual editor toolbar a ways back (not exactly sure when it disappeared). When you go to Text view mode the content and markup is entirely visible. When you go to Visual view mode the content is there but white text on white background. Plus, the visual editor toolbar is missing all together. I am running 18 plugins on this site -- none …
Category: Web

Adding a Media Button to the WordPress Content Editor

So i'm trying to add a button over the text editor which on pressed lets the user paste in a youtube link which is then covered in shortcode something like this [code]youtube.com[/code]. Following this guide lets me show the button however pressing the button does northing. nothing afterwards pops up. See screenshots for clarification. And here's my code: jQuery(function($) { $(document).ready(function(){ $('#insert-my-media').click(open_media_window); }); function open_media_window() { if (this.window === undefined) { this.window = wp.media({ title: 'Insert a media', library: {type: …
Category: Web

Is it possible to disable the image alignment options in the post editor?

By default, when you insert an image into a post, it has some image alignment options (see below). In my theme I want every image to be full width. Of course, it's easy for me to change the front-end display of the images. But--in terms of usability--I don't want to cause the user to think that they are able to change the alignment. Is it possible to disable those alignment options?
Category: Web

Equation input with preview in classic editor

I use WordPress as a headless CMS, and my frontend is made with React. There's no theme or live preview. I'm looking for a plugin to add/edit and preview equations (LaTeX) in the classic editor. This is an example of what I want, but with CKEditor: https://jsfiddle.net/isaul32/3wjrkLdv/ Most of the plugins I find are outdated, and some of them like KaTeX (which I'm planning to use its js library for frontend) only support live preview in gutenberg blocks. The reason …
Category: Web

How to force wp excerpt to use br tag?

wp editor was replacing br tag with p tag. not all the solutions here worked. It was causing problem with design. So i disabled wpautop with below code.... remove_filter( 'the_content', 'wpautop' ); Forgot to mentioned that excerpt disappears if used.... remove_filter( 'the_excerpt', 'wpautop' ); However, the problem still persist for excerpt. In excerpt adding single br works but two br becomes p In order to style p of excerpt i am using below filter... add_filter( "the_excerpt", "add_class_to_excerpt" ); function add_class_to_excerpt( …
Category: Web

How to allow code like PHP, SQL, HTML to WPBakery Visual Composer?

I want to allow code inside a textarea to write code with PHP, SQL or HTML... What i want to do is create an element inside the Visual Composer where I can put some code to show it as i write it on my posts. Here you can find the type values: https://kb.wpbakery.com/docs/inner-api/vc_map/ But no one of these works for me. There is a proper way to do that? array( "type" => "textarea_html", "heading" => esc_html__("Text", "js_composer"), "param_name" => "text_code_snippet", …
Category: Web

Why is wordpress suddenly stripping away all newline characters and how to disable this?

I've spent about 3 hours trying out various functions to figure out why the newline characters are being removed every time I save. How do I figure out why is wordpress suddenly stripping away newline characters? I have not installed any plugins. How can I get newline characters to show up on my site without converting all blocks to HTML and modifying everything in code?
Category: Web

WordPress Visual Mode Not Working - adding span code while clicking

After the update of WordPress 4.9.6, I got a very strange issue that I am not able to write anything in WordPress editor in visual mode. When I'm trying to switch from text to visual I am getting this span code instead of text. <span style="display: inline-block; width: 0px; overflow: hidden; line-height: 0;" data-mce-type="bookmark" class="mce_SELRES_start"></span> Can anyone help me out with this issue? I am not able to write anything.
Category: Web

Adding microdata using Structured Data Markup Helper HTML

I am trying to add schema microdata to a wordpress website. I have tried to insert some microdata directly in the wp editor (text mode) but every time i save the page it does not save the code. I tried a few plugins but when I check with the structured testing tool it doesn't seem like they are working. I generated the microdata using this tool, but I am not able to edit the html. Can I do it via …
Category: Web

How to Analyze Blocks and find Intersection and patterns between pages

What is the best way to analyze existing site fully built on Gutenberg Blocks and inspect intersection of existing blocks structure and it’s inner blocks combination for all pages? Context: Imagine that instance have: ~100 landing pages and СPTs(not just blog posts) that built using core block, custom and some vendor blocks. each page using about 150 blocks (according on Query Monitor -> Blocks counter) no components at all: there are a huge blocks fragmentation in components/layouts, like you are …
Category: Web

How to make Wordpress and TinyMCE accept <a> tags wrapping block-level elements as allowed in HTML5?

Starting with version 5 the HTML standard allows &lt;a&gt; tags wrap block-level elements. On a specific page I need to wrap a heading and an image with an &lt;a&gt; tag: Some intro text. &lt;div&gt; &lt;a href="http://somewhere/"&gt; &lt;h4&gt;Some heading&lt;/h4&gt; &lt;img src="http://somewhere/some-img.jpg" alt="Some image" /&gt; &lt;/a&gt; &lt;/div&gt; While I can enter this in the text editor it causes some strange behavior: The code above will be transformed into this HTML code: &lt;p&gt;Some intro text.&lt;/p&gt; &lt;div&gt; &lt;a href="http://somewhere/"&gt;&lt;/p&gt; &lt;h4&gt;Some heading&lt;/h4&gt; &lt;p&gt;&lt;img src="http://somewhere/some-img.jpg" alt="Some …
Category: Web

Open Insert/edit link popup

I'm using visual editor on front end. When clicking the Add/insert link button, it displays following By clicking Link options icon, the following popup appears Is it possible to directly open the above popup by clicking on the Insert link button from the editor?
Category: Web

TinyMCE strips off the href tag inside span, if i change from text to visual

As mentioned in the title, the TinyMCE editor of WordPress cuts off the href tag that I have inside the span tag. Below is the code i use &lt;h5&gt; &lt;a href=&quot;#&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; &lt;i class=&quot;fa fa-map-marker&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; Find us&lt;/a&gt; &lt;span class=&quot;icon-right&quot;&gt;&lt;a href=&quot;https://testsite.com/test-gallery/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt; &lt;i class=&quot;fas fa-images&quot; aria-hidden=&quot;true&quot;&gt;&lt;/i&gt; &lt;/a&gt; &lt;/span&gt; &lt;/h5&gt; So every time I switch from text to visual and then back to text, this is the result of the code: &lt;h5&gt; &lt;a href=&quot;#&quot; target=&quot;_blank&quot; rel=&quot;noopener&quot;&gt; &lt;i …
Category: Web

TinyMCE editor is breaking my beautiful HTML

This is pretty much an exact duplicate of: How to make Wordpress and TinyMCE accept &lt;a&gt; tags wrapping block-level elements as allowed in HTML5? and HTML5, WordPress and Tiny MCE issue - wrapping anchor tag around div results in funky output My problem is that the suggested solution (tiny_mce_before_init filter) doesn't seem to solve my problem. I have HTML that looks like this: &lt;a href="#"&gt; &lt;img src="path/to/file.jpg" /&gt; &lt;p&gt;Some amazing descriptive text&lt;/p&gt; &lt;/a&gt; The is perfectly legal in HTML5. However, …
Category: Web

Add custom TinyMCE 4 Button, Usable since WordPress 3.9-beta1

How is it possible to add a custom button to the visual editor TinyMCE, Version 4? Currently I found this q&amp;a with a little bit hints to the topic, but not a solution or a how to. But I can't find a tutorial, documentation, q&amp;a for the topic to add a custom button to the TinyMCE version 4, include in WordPress since version 3.9-beta1. Goal
Category: Web

Forcing reload of editor-style.css

Is there a method to force the refresh of editor-style.css, when I change manually the stylesheet for the TinyMCE editor? Modification doesn't show immediately but they will be cached in the admin side of administration backend. For example like this: editor-style.css?ver=3393201
Category: Web

Pasting code into pre-formatted text in Visual Editor not working in 3.3.1

Pre-formatted text in the Visual Editor is not behaving like I'm used to. I've got an old installation (3.2.1), and when create pre-formatted text, all the line-breaks and spacing is preserved. In the latest version (3.3.1), the line breaks are interpreted as new paragraphs, and the code is broken across those paragraphs, leading spaces removed. Process: Copy code from text editor. Click on the &quot;New Post&quot; link. Choose &quot;Preformatted&quot; from the format menu. Paste (ctrl-v). 3.2.1 - Correctly formatted code …
Category: Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.