Monday, 29 April 2013

My Wordpress Theme has a TimThumb script that i can't get to work

My Wordpress Theme has a TimThumb script that i can't get to work - Now What !! Having a look around the web it seems I'm not the only one that seems to have been struggling with getting the TimThumb script to work. Tim Thumb Issue Well here's my hack for a theme when all was lost. This is the code I had in the theme that called up the Tim Thumb script. Here's the call up from the template.
echo themex_thumbnail($post->ID,738);
And then the function in the templates functions.php
function themex_thumbnail($ID, $w = 0, $h = 0){
 global $blog_id;
 $src = wp_get_attachment_url( get_post_thumbnail_id($ID) );

 if (isset($blog_id) && $blog_id > 0) {
  $imageParts = explode('/files/', $src);
  if (isset($imageParts[1])) {
   $src = '/blogs.dir/' . $blog_id . '/files/' . $imageParts[1];
  }
 }

 $url = THEMEX_URI.'extensions/timthumb/timthumb.php?src='.urlencode($src);
 if($w = intval($w)){
  if($h!=0 && $h=intval($h)) { 
   $url.='&w='.$w.'&h='.$h.'&a=t';
  } else {
   $url.='&w='.$w;
  }
 }
 return $url;
}
Here's the call up I've replaced with
echo lrip_gallery_thumbnail($post->ID,'blog');
And the following function. You can add all your different sizes to this list, and change the 'blog' call up; for example 'small' !
unction lrip_gallery_thumbnail($ID,$size){  
 global $blog_id;
 $src = wp_get_attachment_url( get_post_thumbnail_id($ID) );
// going to explode using .jpg and fix on a new ending 
 $img_url_array = explode('.jpg', $src);
 if ($size=='small'){
 $img_url = $img_url_array[0].'-150x150.jpg';
 } elseif($size=='blog'){
 $img_url = $img_url_array[0].'-738x415.jpg';
 }else {
 $img_url = $src;
 }
 return $img_url; 
} 
As well as making a copy at the right size and with '-738x415' add to the end of the filename; we also need to make it so the Wordpress automatically makes additional sized images. Its pretty simple all you need to do is add this to the main function.php

add_image_size( '738x415', 738, 415, true );
the first part is the name reference. It'll stick the size on the end anyway. And then comes the sizes and at the end the 'true' tells us that the image will be cropped to these sizes. And that's it.

No access to wp-admin folder Error 310 (net::ERR_TOO_MANY_REDIRECTS):

I'm using simple-301-redirects and got this message The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. Error 310 (net::ERR_TOO_MANY_REDIRECTS): Take a look at this post Error 310 Error Which indicates it's probably a permissions problem . However in my case when going to check my Permissions i noticed the wp-admin folder had disappeared re-uploading my last copy fixed the issue.

PHP function to take a copy of your Database

On occasion you may only have FTP access to your website and need to take a snapshot of the database.  Here's a quick hack


Friday, 26 April 2013

joomla 1.5 administrator started displaying recaptcha message

This has started in the last week on my Joomla installations. 

I get the messagein Joomla Administrator

Are you human?

We have detected an increased number of attempts to access this login page. To help us keep this website secure, please let us know that you’re not a robot by entering the text from the captcha below.



After doing a search for:

joomla 1.5 administrator folder recaptcha

joomla 1.5 administrator started displaying recaptcha message


 I found this post Joomla admin folder showing reCaptcha  - and it seems its something being added by shared host providers.

In my case Heart Internet.

Thursday, 4 April 2013

Joomla Virtuemart Store - Google PageSpeed Insights telling me GZIP not working.

After running a page speed test on Google PageSpeed test it was coming up that many pages weren't being Gzipped.  Even though this GZIP test http://www.whatsmyip.org/http-compression-test/ was telling me GZIP was activated. 

I checked that the feature was active in Joomla .  This is in

> admin
> click on 'site'
> drop down to 'global configuration'
> click on 'server' tab
> and make sure the 'GZIP Page Compression' radio button is ticked.



What I did to solve the issue was to untick this feature and do the gzip by .htaccess instead.  

Here's a guide on to do this 'use gzip in .htaccess'

in short you need to use this code in .htaccess


SetOutputFilter DEFLATE


Wednesday, 3 April 2013

Wordpress 'Fast Secure Contact Form' - setup for radio and Multiple Selections

I was getting this message after attempting to set up some different types of form inputs on www.mitweb.co.uk 

Error: A radio field is not configured properly in settings.

Error: A select-multiple field is not configured properly in settings.


To fix this .

>  go to your admin area

> on the left go to 'Plugins' and then 'FS Contact Form Options'

> Scroll down to 'Extra fields' and in the 'Label field' it needs to be formatted like

Colour:,Red;Green;Blue

so my radio box was ->  Message Type:,Quote;Order




Tuesday, 26 March 2013

Facebook Marketing - 2013

Here's a couple of notes I took down while watching their introduction videos.

The Fanpage

> Change the cover photo

> Add opening times and some business information.

Connect to Fans with Ads

> Identify target Audience
> Create multiple ads for each audience
> Roll out winning ads and rotate regularly


The advertising Steps.

> get Fanpage ready

> connect to Fans with Ads

> Engage your fans with quality content

> Influence the friends of your fans