How to display adsense in every WordPress post.

If you run a blog and want to see if you can make some money from it, the chances are you might want to try use google adsense to display relevant ads in the post.

One simple way is to copy/paste the adsense script into the post content.

Whilst this works and is a good way to place ads at different locations on each post there is also a nice way to place ads on every post.

Below a link ad unit works well at the top of each post, the ads automatically display relevant content to the topic of each post.

Here you can I have link units which appear on each post at http://diyvoucher.co.uk/

To do this I edited the single.php file which can be found in (twentyten theme)…

wp-content/themes/twentyten/

Download the single.php file and add the adsense code with a suitable editor.

Here’s where I placed it in the php..

Pop over to http://diyvoucher.co.uk/ to see how the ads work.

Phil

Posted in Uncategorized | Leave a comment

Set div to browser height with jquery

I’ve been with some jquery which sets certain div elements to the height of the browser window.

This is great is you want  to section a long page and use different backgrounds in the various sections.

Creating a fixed menu at the top of the page and using jquery to scroll to the various sections would look very nice.

Here’s the code to set the div heights to the browser window. Obviously if you want to add content you’ll probably want a minimum height so It’s been set here to 600px.

here’s the jquery code,  click here for the demo

$(document).ready(function() {
//set the minimum height to 600
var minHeight = 600;
//sets dive one, two, three to browser window height
$(“#one, #two, #three”).height($(document).height());
//sets the var actual height to height of div one
var actualHeight = $(‘#one’).height();
//if the actual height is lower than the minimum height it sets the all heights to the minimum height.
if (actualHeight < minHeight){

$(‘#one, #two, #three’).css({‘height’ : minHeight});
};
});

Posted in Uncategorized | Leave a comment

New Laminate Flooring Calculator Javascript

Visitors to Diy Laminate Flooring can benefit from a new calculator to help them work out how many packs they need.

The new tool is has been wrote in javascript by myself and replaces the old flash version.

Using javascript should make the tool accessible to mobile devices which commonly don’t support flash.

Javascript code for the calculating

<script language="javascript">
function calculate(){
//collect data from form 

 var w = document.calc.width.value;
 var l = document.calc.length.value;
 var packSize = document.calc.packSize.value;
 var pricePack = document.calc.pricePack.value;

//calculate roomSize width x length

 var roomSize = (w * l);

//calculate number of packs roomsize / packsize, round up to next whole number
var numberPacks = Math.ceil(roomSize / packSize);
//calculate total price numberpacks x price pack
var totalCost = (numberPacks * pricePack);
//display results
if (!isNaN(numberPacks) &&
 (numberPacks != Number.POSITIVE_INFINITY) &&
 (numberPacks != Number.NEGATIVE_INFINITY)) {

 document.calc.roomSize.value = roomSize;
 document.calc.numberPacks.value = numberPacks;
 document.calc.totalCost.value = totalCost;
}
else {
 document.calc.roomSize.value = "";
 document.calc.numberPacks.value = "";
 document.calc.totalCost.value = "";
}
};
</script>

Visit http://www.diylaminateflooring.co.uk/calculator.html to see the calculator in use.

Posted in Javascript | Leave a comment

Front end web developer

I’ve took a step back and had a good think about where I’d like to go with my career development and goals recently.

To move forward with Tyneside Graphics and provide a great service to my web design clients I’ve been looking at the roles advertised as ‘front end developer’.

While I’ve been at college for the last three years there’s been quite a bit going on with HTML5, CSS3 and javascript, jquery.

So this is my homework, to bring my front end development coding up to date to make sure my services are the best they can be.

 

Posted in Uncategorized | Leave a comment

Learn Maya 3D

I’ve chosen to learn a 3D rendering and animation package for my professional career development.

Maya by Autodesk is my software package of choice, although I suspect they’re all pretty similar.

Steep Learning Curve

This isn’t for the faint hearted. I’ve never seen so many menus and options, but after a quick head over to youtube to watch a couple of demos, I was still none the wiser!

My first render was a simple Ice cream cone.

This introduced me to the basic tools, polygon creation and how to apply new materials and colours.

My second render

Here I’ve taken an image and mapped it onto the front of a cube, Maya can generate photoshop template files to help you.

My third render.

Here’s a highlighter, it looks pretty basic but did introduce me to bevelling edges, adding extra segments and extruding them.

The hardest part is understanding Mayas control and options panel on the right – I seem to be getting used as I go along.

Phil

Posted in Maya 3D | Leave a comment