Artikel in Serie WordPress

Not Being Tracked by Functions In WordPress Core

Install the plugin „Disable Google Fonts“ to disable the loading of „OpenSans“ from Google when using WP admin. The font brings no advantages over the standard appearance of WP admin.

Note: „Disable Google Fonts“ is abandoned, and WordPress core apparently stopped loading fonts from Google.

Install the plugin „Disable Emojis“ to disable the loading of an external SVG.

Support For Multiple Languages in WordPress

Introduction

Foreign visitors have pointed out to me that they sometimes read my blog using translation functions in their their webbrowsing software, most notably „Google Translate“ which is directly built into Google Chrome. That translation function does a good job, but sometimes produces oddities, for example it attempts to translate my lastname, which is also a valid German vocable.

That problem was quickly addressed by adding the class="notranslate" plus the HTML5 language attribute translate="no" to a <span> surrounding my name. But this incident contrasted a deeper problem that has been troubeling me for a while now.

Weiterlesen … »

Adding Custom Format Buttons To tinyMCE in WordPress 4

Introduction

In my technical articles I sometimes use inline fragments typed in a monospace font to highlight code or filenames that appear within floating paragraph text. Back in the days I did this with the <tt> element, nowadays I use <span class="tt"> and a CSS style like

.tt { font-family: monospace; }

I wanted to extend the tinyMCE in WordPress with a toggle button that behaves like the Bold or Italic buttons and surrounds selected text with such a <span class="tt"> element or, when pressed while an already surrounded text is selected, removes that surrounding again. Also, when the cursor is inside such an element, the button should switch to an „active“ state that indicates that the character format can be deselected.

Weiterlesen … »

WordPress-Plugin to Embed Gitlab Project Information

For my personal use, i wrote a small WordPress plugin that allows me to embed a link to a Gitlab repository, a list of commits and a link to the releases of that project in a WP post.

Example (linebreaks added to shortcode for readability):

[​gitlab-show-project
    url="https://tk-sls.de/gitlab"
    project_id=43
    max=3
    author="none"
    releases="latest"​]

Output:

Gitlab-Projekt linuxfoo-gitlabLetzte 3 Commits:2022-08-28 : fb5d9a8f tab vs space cleanup2022-01-01 : f6abb63a add option author="none"2021-11-30 : 4b7b8d4a project_header formattingNeueste Release: v1.4.4

Weiterlesen … »

Removing the Builtin Inline CSS from WordPress

Should you – as i did – wonder why WordPress renders a bucket of inline CSS into the HTML output (such as --wp--preset--font-size--normal in <html> or  --wp--preset--color--white in <body>): This is done to accomodate frontend editing with Gutenberg. If you – as i do – are not using Gutenberg frontend editing, then the following PHP code can be included in the functions.php of a custom theme or the php file of a custom plugin. Sorry, Gutenberg folks – no means no. 🙂

Weiterlesen … »