Archive for the ‘Websites with Wordpress’ Category

Googlebot cannot access CSS and JS files

October 18, 2015

Thousands of websites started receiving this message relatively recently. It’s to do with mobile friendliness and it requires a change to the robots.txt file. Thanks to the following sites that provided the solution:

Look for the messages in Google Webmaster Tools to see which sites are affected.


Our Studio Blog has Moved

January 3, 2014

The Tinstar Graphic Design and Studio Blog has moved – we’ve brought it back under the wing of our main website. Come by any time.

Pass dynamic data from a link to a form

August 22, 2013

In WordPress, use the following to extract a string from a URL:

$jobreference = $_SERVER['QUERY_STRING'];

So from a previous page you can add a dynamic string to a link. When it leads to a contact form, the unique string can be extracted and echoed into a form field. For example, from:

$jobreference will be: “string”

Building a custom contact form for WordPress

August 14, 2013

Almost as simple as you think.

Adding Page Content to a Different Page in WordPress

March 22, 2012

With thanks to this post, this snippit of code (when added to a template) will allow you to create page content (or several pages) that can be inserted into another page, thus making any content management a little easier to cope with by a client. For example, instead of editing one big page with a variety of content (and risking damaging the layout), you can just edit single blocks of text that will automatically appear on your designated page.

<?php // Create second WordPress loop $page_content = new WP_Query( 'pagename=page-slug' ); while( $page_content->have_posts() ) : $page_content->the_post(); // Your content output goes here echo '<h2>'; the_title(); echo '</h2>'; the_content(); endwhile; // Don't forget to reset the post data! wp_reset_postdata(); ?>

If permalinks are set to default, pagename=page-slug becomes page_id=8 (substitute ‘8’ for the actualy page ID number).

Add Identifying CSS Class to WordPress Caption Boxes

February 23, 2012

It’s been a source of some irritation up to now that WordPress caption containers have been somewhat unwieldy when it comes to styling. I really wanted them to behave differently depending on what size image they contained, and whilst the images have identifying hooks (like size-large & size-medium etc) the caption containers just displayed wp-caption and wp-caption-text (other than the dynamically generated individual image identifier).

What I had to do in the end was ‘hack the core’ and make a very slight adjustment to the includes/media.php file as follows:

I changed this line (approximately line 745):

return ‘<div ‘ . $id . ‘class=”wp-caption ‘ . esc_attr($align) . ‘” style=”width: ‘ . (10 + (int) $width) . ‘px”>’

to this:

return ‘<div ‘ . $id . ‘class=”wp-caption ‘ . ‘imagesize’.$width . ‘ ‘ . esc_attr($align) . ‘” style=”width: auto”>’

This achieved two things. First it removed the automated additional 10px width added to the box (taking the image width and adding 10 pixels). Secondly it added a CSS class after the wp-caption entry. This becomes imagesizexxx. The xxx becomes whatever the image width is. That way you can specify exactly how you want the caption box to behave depending on what width image it contains.

Problem using the WordPress App to edit a self-hosted blog

February 20, 2012

If you want to edit your WordPress self-hosted blog using the iPhone or iPad App, you may come across an error message that reads: “http/1.1 405 Method Not Allowed”. The reason for this is that the file in the root of a WordPress blog that smart devices access for editing purposes: xmlrpc.php is often used by hackers to access a website and cause malicious damage. For this reason Web Hosts take a flamethrower approach by blocking all access to the file.

I ran across this issue whilst trying to add a blog to an iPad version of the App. The blog is running on WordPress 3.3.1 and I managed to solve the problem by following these steps:

  1. Rename the xmlrpc.php file via FTP (found in website root) to xmlrpc_whatever.php
  2. Through WordPress Dashboard, click on Plugins / Add New and search for Rename XMLRPC
  3. Install Rename XMLRPC plugin but don’t activate it
  4. Find Rename XMLRPC plugin in list and click ‘edit’
  5. Locate the line that reads:
    $renamed_xml_rpc_filename = ‘xmlrpc2.php’; //CHANGE THIS pointing to the renamed file
  6. Change the filename xmlrpc2.php to xmlrpc_whatever.php and click Update File
  7. Activate the plugin
  8. In the WordPress Dashboard, go to Settings / Writing
  9. Near the bottom of the page find and tick the checkbox: Enable the WordPress, Movable Type, MetaWeblog and Blogger XML-RPC publishing protocols.
  10. From your device WordPress App, add a self-hosted WordPress blog and make sure the address is:

This should now add the blog without further error.