WordPress 4.5 Custom Logo API: Getting the logo URL

WordPress 4.5 is here with a new API for a Custom Logo.

Just by adding an add_theme_support like this:  add_theme_support('custom-logo');
Remember it’s best called in the after_setup_theme hook.

So now you’ll have a logo selector in your themes customiser.  You can then use the following to detect the logo, echo the logo or return the logo as a string:

Great I hear you say.  But what if you want to use the image as a background? get_custom_logo() returns the full <img /> tag.

After a bit of digging I found the image ID is stored as a modification for the theme, and retrieve it with this:
$custom_logo_id = get_theme_mod( 'custom_logo' );

Once you have the ID you can get the url and other info as normal with wp_get_attachment_image_src.
$logo_meta = wp_get_attachment_image_src($custom_logo_id,'full');

You can wrap this all up in a nice little function.

function get_custom_logo_src() {
    if (has_custom_logo()) {
        $custom_logo_id = get_theme_mod( 'custom_logo' );
        $logo_meta = wp_get_attachment_image_src($custom_logo_id,'full');
        return $logo_meta[0];
    } else {
        return false;

Hope this helps!

Search Relevance 2.0

Search relevance has been updated to 2.0 adding new features to control the display of  relevance score, highlighting search terms and custom excerpts focused on the relevant part of the post.

Still giving you amazingly relevant search results, out of the box, without the need for complicated indexing.

If you have any ideas/requests for simple features to add, just hit that comment button now!  Just remember I want to keep this nice and lightweight and simple to use 😉

Reviews have already started to come in – and they’re looking good!
Over at  http://www.echodesplugins.li-an.fr/plugins/search-relevance/ Li-An said

A little comparison with Relevanssi shows me a gain of 1.5 seconds on the results page of my most used word. This is for now, in my opinion, the most interesting alternative to the default search WP for people who are looking for quick results.


WordPress Developer Debug.

When developing themes and plugins for WordPress I often find myself with the dreaded white page – or just half a page with no useful error information.

You may already know about the WP_DEBUG constant, if you don’t its found in your wp_config.php file and you just change it to…

define('WP_DEBUG', true);

to turn it on debugging.
Chances are that with this turned on your WordPress will start spewing out a load of warnings you never even knew were happening!

This ‘error noise’ is fine for a development site. But what about if your site is live and need to code a new feature?

I came up with this little trick so I can turn on debug mode in the page request.

$debugmodeon = false;
if (isset($_GET['debug'])) {
	if ($_GET['debug'] != "") { 
		$debugmodeon = true;
define('WP_DEBUG', $debugmodeon);

Just add ?debug=true and voilà – debugging info only when you need it 😉

Once your done – you’ll want to swap back to define('WP_DEBUG', false); so your ‘debug mode’ can’t be triggered by accident..

Gmail issues on Mac OS X. [Nonexistent]

When moving over from using Gmail via MS Outlook to OS X a little know error sometimes occurs with labels and folders.

If Apple Mail reports “Mailbox Does Not exist”, or Thunderbird gives “[Nonexistent] Unknown Mailbox” then all you need to do is rename your labels.
Folders created in Outlook became labels with the name Inbox/FolderName. But OS X Mail and Thunderbird both look for INBOX/FolderName. Simply edit your labels to change the case and all will work fine.

WordPress Fixes: Showing content – not excerpt in searches.

Came across this one and it took a little tracking down to fix - so in case someone else has this issue - heres how i fixed it 😉

Came across this one and it took a little tracking down to fix – so in case someone else has this issue – here’s how I fixed it 😉

The Problem…

Search result pages in WordPress are showing a generated snippet from the post content, not the excerpt.   After confirming that the post does indeed have a custom excerpt specified for it, here’s what I did next…


First thing to do is the check is that you are using the_excerpt() in your template.  Look in your /wp-content/themes/[yourtheme] folder for search.php or if that’s not there – index.php.

In that file find the wordpress loop – it’ll start like this…
while (have_posts()) : the_post();

Make sure it has the_excerpt(); not the_content();, it could be like this

<?php if (is_archive() || is_search()) { ?>
    <?php the_excerpt(); ?>
<?php } else { ?>
    <?php the_content(); ?>
<?php } ?>

If you can see the_excerpt() – chances are you have the right template.


Once you’ve confirmed the templates is correct and the post has an excerpt, then you need start disabling plugins.
If possible turn them all off – then enable one at a time till you find the offender.
If it still happens with all plugins disabled, then its definitely your theme that’s to blame.

For me..

In my case the problem turned out to be (obviously with hindsight) Relevanssi. Relevanssi has an option to reformat your search result content to show the relevant result. This most likely results in a part of the content being shown – not the excerpt you specified. Its just a tickbox away to fix (Create custom search result snippets) 😉

Hope this helps save someone some time debugging!

Joining Imagiscape

Lots of new things happening in the world of Sabletopia.

Firstly I’ve joinned the team at ImagiScape as one of their plugin developers.  Already my first plugin for them (ZombieMod) is providing several different flavours of zombie for their Zombie Apocalypse server.  I’m also working on bringing the wiki uptodate 🙂

Sabletopia has now moved over to join with my plugin testing server, so it’ll have lots of new weird things.  Already it has a new flatlands WorldGenerator, and I’m testing Cityword to see if I can make it more apocalyptic so we can have an infinite MmineCraft city!

Existing projects continue – MobHealth is now on version 4.8.2 (4.8.3 is coming out soon).  And my super secret project is still, well.. secret but progressing well 😉

WoodDye / Impact and more!

Spate of new Minecraft/Bukkit plugins have joined the ranks at http://dev.bukkit.org/profiles/sablednah

Change the colour of already placed wood.

Leave behind impact craters.  the bigger the fall the bigger the hole.

Now has a whole load of tweaks and options – bit still remains a simple to setup and use family filter.


You can find out more about each plugin on the relevant plugin pages at dev.bukkit.org 🙂  Over the next few weeks each will get some tweeks – ChatFilter will get some extra filtering to spot common ways of hiding words…  WoodDye will extend to half-blocks and fire-proofing as soon as the snapshots are released 🙂


MobHealth – v2.3

So MobHealth is doing well – latest version has got over 2k downloads in <4days.  It seams like the contaversial process of  thorough testing, frequent releases, and shock horror – listening to feedback works!!

Working on adding options to switch between showing notifications for animals, monsters and players. Or any combination of those three.

Then it’ll be digging into 3rd party mobs for hooking in.

All in all with nearly 4k downloads for all version – you’d have thought someone might have clicked the download link (~nudge nudge wink wink~).   If only there was a way to actually make money from these newfound java skilz!