DESIGNED DEVELOPED DELIVERED

Mob: 07760 392284edward@ee-web.co.uk

ee-web thinks... a bit

Go on, make my day ... leave a comment

Kusuma Trust header

September 8th, 2016 by Edward

Recent clients, the Kusuma Trust have some really beautiful photography that draws the viewer in and helps to tell their story. From the outset it was decided to place different pictures across the top to act as the Kusuma Trust header, upon which various menu items would go. They were keen however, not to have a background strip for the menu text to sit on – which clearly creates potential usability issues regarding textual contrast.

The brief suggested that the image was to be :

  • full width
  • fixed depth
  • look good on all screen widths
  • possibly have some headline text fixed to its bottom on a semi-transparent background
  • and… easily maintained by the user

read more Read more…

categories
tag

Pagination and Removing Categories in WordPress

October 13th, 2015 by Edward

Quite often I need to create a new WordPress query – but this can mess up the pagination – so that if you press to go to previous posts it shows the same darn posts again.

Thankfully, it’s relatively easy to solve.

I find that I nearly always need to exclude categories from my query so I am adding that in as well.

Here’s the standard code from index.php file int he 2013 template:

<?php if ( have_posts() ) : ?>
<?php /* The loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', get_post_format() ); ?>
<?php endwhile; ?>

Nothing out of the ordinary there of course.

Firstly we need to add this line:

$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;

$paged is set to the current page that we are looking at – so for example if you are display post 11-20 then its likely that this is page 2 if you have the number of posts per page set to 10.

Next we create a new wordpress query in array format:

$query = new WP_Query( array( 
    'posts_per_page' => 10, 
    'cat'=>-145, 
    'paged'=>$paged 
) ); 
?>

we create a new WP_Query object called $query

  • set the number of posts_per_page to 10 in this case
  • set the categories variable to not show cat id =145 – done by setting the minus sign
  • and set the paged variable to the $paged we set up before
  • And hopefully that’s it.

categories
tag

Buzzing Bees make a …

October 3rd, 2015 by Edward

Recently I have been working with the hugely talented Lydia Thornley on a new website for Sarah and Dale at Bermondsey Street Bees.
dale at Bermondsey Street Bees

One of the great things about this project was the sense of intricate planning that went into the site. Not that I don’t always plan, but for this job NO deadline or project milestone was moved, let alone missed. It was such a pleasure to have all the content when I asked for it. You know how it is with some clients – ‘Please create a timeline’ and within the first week things are slipping… To quote Douglas Adams –

I love deadlines. I love the sound the make as they go whooshing past

read more Read more…

categories
tag

Memory limit in wordpress – solving on cPanel

February 11th, 2015 by Edward

Recently whilst installing some plugins/templates for WP I came across this error whilst trying to access the wp-admin for a wordpress install.

Fatal error: Allowed memory size of 41943040 bytes exhausted ....

We are on a shared server, so changing settings directly was not going to be a solution

By creating the famous phpinfo() file I saw that the memory_limit = 32M

Sometime later…
… I hit upon this:

Create a php.ini file in the home directory and add in this line -with whatever memory_limit you want

memory_limit = 128M;

That’s good, except that it only works for the folder within which the php.ini file was sitting – we need to make it so that every folder would (as it were) carries out this command – this is called making it ‘recursive’ and is done in the .htaccess file.

Where’s my .htaccess file eh?
Now, wordpress doesn’t create the .htaccess file until you set the permalinks – something it took me a good 15 minutes of surfing around to discover. Here was a problem. I needed to get into the backend of WP but it was unavailable due to the memory limit! What to do?
read more Read more…

tag
categories
tag

Adding FB like box code to wordpress

October 29th, 2014 by Edward

The standard answer out there seems to be ‘use a plugin’ – but I wanted to do it from scratch. The fb code for the like-box says something like ‘put this code as close as possible to the <body> tag – but again the advice I found seem to have that ‘it will work anywhere in the page’ type of attitude – and I am sure they are right, but I wanted to follow the FB instructions.

After some digging around with thematic I found out that this can be hooked like this:

add_action('thematic_before','fb_like_box_setup',5);

– I guess you could use a different index number…

Adding to the ‘thematic_before’ hook places the code directly after the body tag. Cool!

Now I created the function ‘fb_like_box_setup and pasted in the fb code. But this threw all sorts of errors – the code needs echoing out, and in the end, after good old stackoverflow, I came up with this:

function fb_like_box_setup(){       
 $fbData='   <div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, "script", "facebook-jssdk"));</script>';

echo $fbData;
}

In effect put the whole lot into avariable, and echo that.
But there’s more

the original fb code is like this:

<div id="fb-root"></div>
<script>(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.0";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));</script>

notice that in the line


}(document, 'script', 'facebook-jssdk'));</script>

the ‘ have been replaced with ” – single with double. So the problem is to do with ‘ and ”

Sorted!

categories
tag

Unhooking Funtions in wordpress

August 28th, 2014 by Edward

I had a design for wordpress that had no footer – except two coloured, full-width bars. I could have just copied footer.php in the childtheme and commented out the thematic_footer() call around line 30.

But, that’s no good really – well it works, but I wanted to do by removing (unhooking) actions from the do call. So, searching through the whole thematic template I found there – (on different lines of course)

do_action('thematic_footer');
add_action('thematic_footer', 'thematic_subsidiaries', 10);
add_action('thematic_footer', 'thematic_siteinfoopen', 20);
add_action('thematic_footer', 'thematic_siteinfo', 30);
add_action('thematic_footer', 'thematic_siteinfoclose', 40);

So, best thing to do then is to unhook these functions that are added to the thematic_footer and add my own new on.

So, off to functions.php within my child template to add this:

		//remove all the inbuilt footer stuff.
		remove_action('thematic_footer', 'thematic_subsidiaries', 10);
		remove_action('thematic_footer', 'thematic_siteinfoopen', 20);
		remove_action('thematic_footer', 'thematic_siteinfo', 30);
		remove_action('thematic_footer', 'thematic_siteinfoclose', 40);

would seem the obvious thing to do – but ah ah! It wont work – got to make sure things happen at the right time. So we need to add the removes to the init function. So I created a function called ‘fobhs_add_and_remove’, added it to init and then declared the function – and now it works!

add_action( 'init' , 'fobhs_add_and_remove' , 15 );

function fobhs_add_and_remove() {
        add_action('thematic_header', 'fobhs_add_header',2);
		//remove all the inbuilt footer stuff.
		remove_action('thematic_footer', 'thematic_subsidiaries', 10);
		remove_action('thematic_footer', 'thematic_siteinfoopen', 20);
		remove_action('thematic_footer', 'thematic_siteinfo', 30);
		remove_action('thematic_footer', 'thematic_siteinfoclose', 40);
		// add the simple footer supplied - not shown below
		add_action('thematic_footer','fobhs_footer', 50);
}

Now it works! Next step to create the function ‘fobhs_footer’ and to add in the what’s required to create the bars.

categories
tag