Adding a WordPress admin page in itself is pretty straightforward, and well documented. You do it using the add_menu_page function, something like this… add_menu_page(‘My Page’, ‘My Page’, ‘manage_options’, ‘my-page’, ‘show_my_page’, ”, 1); This function takes the following parameters: Page title (required) – the text to be displayed in the title tags of the page when the…
Tag: php
Adding a custom WordPress editor via javascript
Working on a project today I needed to have 99 WordPress rich editors (powered by TinyMCE) on one page, and let me tell you, this absolutely kills the page load time! In the first iteration I’d done this purely in PHP using wp_editor, like this… $value = ”; //this is the current value if there…
Updating WordPress post metadata
I was fighting with a WordPress issue earlier today, and the solution turned out to be pretty simple, and a clear case of me not reading the WordPress developer resources properly. The situation arose because I was updating a number of post metadata fields and trying to count the number of edits, like this… $count…
WordPress, why no get_the_widget?
So the problem I was having the other day was that I wanted to be able to output a widget on a WordPress custom theme archive page, but I didn’t know where the user wanted to put it, or what attributes they wanted to pass in, it needed to be really flexible (isn’t that always…
PHP vs BOM
I’ve just fixed a little head-scratcher, and as a little reward to myself, I’m going to write about it. Well, I’m sat on train, so methods of celebration are a little limited. Anyway, what’s that title about? PHP is a popular general-purpose scripting language that is especially suited to web development. And a BOM (or Byte…
Time To First Byte – part 2
I often do performance optimisation on WordPress sites for clients, and have recently completed such a project. One really critical metric I explored is Time To First Byte (TTFB). But it can be hard to really drill down into it. In my last post I spoke specifically about how to use the Server-Timing response header…