!important

February 4th, 2011

!important forces shit to happen.

Lets say you  have a script that does a drop menu – hybrid menu for instance but whatever you  do in your stylesheet you  cant get the width of the drop down right. becasue somehwre buried in  the javascript is somthing  that stops your css styling from working.

Slap !important at the end of that one style: width: 210px !important; and that forces the page to obey you.

change template for different Post categories

January 31st, 2011

add_filter(‘single_template’, create_function(‘$t’, ‘foreach( (array) get_the_category() as $cat ) { if ( file_exists(TEMPLATEPATH . “/single-{$cat->term_id}.php”) ) return TEMPLATEPATH . “/single-{$cat->term_id}.php”; } return $t;’ ));

well i hope this will help me later

or maybe look here:

http://codex.wordpress.org/Creating_an_Archive_Index

WordPress – moving folders, changing passwords,

July 19th, 2010

Having just botched up  a wordpress folder move i think i had better write this down.

Move WordPress Folder

To move the install of WordPress go to:

Settings>General and change your wordpress address (URI) and blog address (URI) from http://www.youraddress.com/testfolder/ to http://www.youraddress.com (if thats where you  want it). Update.

Instantly the system is broken – DON’T PANIC.

Now move the contents  of testfolder to root (ie public_html or wherever you  want to site to be.

I would advise not downloading  and re-uploading  but moving it online in  FTP, dreamweaver etc..

It should all start working.

A video here: and the instructions that i used.

Changing Password

The above all went wrong for me when i moved the site  and then change the Settings>General stuff. i ended up  scrabbling  around PHPMy Admin changing  stuff.

Which turned out to be not so bad:

  1. Login to phpmyadmin.
    Click ‘databases’
  2. A list of your databases will appear. Click the one that is your WordPress database.
  3. All the tables in your database will appear.
    Click on the small icon indicated. Hovering this icon should show the word ‘browse’.
  4. The next screen will show who is registered on your blog.
    You need to look at the top line there. User ID #1 is you – the blog owner. You will see your login name, then a long string of letters and numbers. That’s your password.
  5. Click the pen icon.
  6. Now you see all the details associated with that user.
    Across from the ‘user_pass’ is your encoded password.
  7. Delete that long string of characters.
  8. Now type in the password you want to use. Just type it in normally, but remember, it is case-sensitive.
  9. In this example, my new password will be ‘carrots’ (1)
  10. Once you have done that, click the dropdown menu indicated, and select MD5 from the menu. (2)
  11. Now check that your password is actually correct, and that MD5 is in the box.
  12. All good ? Click the ‘Go’ button to the bottom right.
  13. You have returned to a screen you were at earlier. Note that your password has changed.
  14. Now go back to your blog’s login screen, and hopefully now all is well.

Taken from here>

Where are Joomla Module Positions?

July 13th, 2010

i always forget this simple trick:

  • Add /?tp=2 to the end of the URL and all these hints turn up  with the named positions:  http://www.yoursite.co.uk/?tp=2

I’ll try to remember this time

Joomla can’t add up weights with Attributes

June 17th, 2010

Which is very boring.

If i have a product that is shipped by weight i hope that by adding  attributes:  1kg of sweets= £5, 3kg of sweets = £10, then i would hope that the shipping  module would see the weights (and not just the prices) and add them to the postage. But it does not. It treats the additionsl options as the same weight as the original product (in  this case 200g).

So, how do you  get round that?

Child items seems to be the answer.Though its a bit rough.

  1. You  have to add an attribute via the Attribute List – God knows why – all it adds is an ugly word – i called mine Discount which it display as Discount().
  2. Having  done that i can add Child Items – my 1kg and 3kg bags.
  3. Then i have to remember to delete the old attribut e list before the Clild items actually work – i do and then they do. Hurrah!
  4. But, now i have to fiddle with the parent products Display Options
    - Use List box for child products – Tick
    - Add to Cart Button for each Child – Tick

Otherwise, without the Add to Cart Button for each Child, each child option has a quantity of 1 as the inital setting and the one Add to Cart button then adds all 3 items, which then disturbingly kills the shopping  cart!

But, as i say,  Add to Cart Button for each Child – Tick, get round this by adding  a cart button  by each item so only one can be added at a time. In  itslef not a perfect option but the only one that works without hacking  the system – it seems.

I don’t like Virtuemart, its so untidy. Expression Engine is so much more controllable, and i suspect Magento may be pretty good too.

The Times Paywall – any bets?

June 15th, 2010

I have a bet on Techdirt (a site i read everyday) that The Times will give up  the paywall when it has 6,666 paying  viewers.

Sadly i don’t think that will happen. There must be  some sort of plan – are they signing  up  corporations at huge discounts so they can claim thousands of  paying  viewers? Is it all a plan to fail so they can use the failure to try to attack BBC funding?

I cannot think of a reason for them doing this. Unless they actually believe this will work? Can they really think that?

The Time Education Supplement supposedly used to have a paywall – but thats a very specific topic that is not covered by many sites. The FT has a lame paywall (turn off cookies – Opera is my main  browser and it is set to delete cookies on closing – close it and reopen and return, though i have only done it once as the FT is not particularly important to me) that is easy to get round. The Wall Street Journal does – but again a specific topic.  But The Times has the same news as everyone else.

At the same time The Guardian Online, i believe, is making  £40m (not sure of the time period there), which is going  up  100% each year.  If it switches off its presses and goes online only (like the BBC) then its probably going  to be profitable for the first time ever quite soon!

I still like the number 6666 though.

Should you sell a link on your site

June 15th, 2010

I’ve had a few clients email me of late about being  paid to have a link or 2 on  their home page to other sites – and getting  paid for it. One of them went for it – a driving  instructor in  Edinburgh. (and yes i do hope this link helps him).

It all seems legitimate – i had an enquiry myself $45 a month from linkbuilding.net.  Eventually i turned it down. I wasn’t sure who the link was going  to be to and i worried that it might lower position in  google  - though the money was tempting.

In  the end i am glad i didn’t because now i  am getting  emails from clients who accepted the offer saying ‘ Nothing  has changed but why am i down a page in  google?’.

Except one thing has changed  - there’s an advert on  their home page that maybe shouldn’t be there.

Add line to Joomla Title tag on all pages

May 25th, 2010

Sometimes i need to add the same text to all the pages of a joomla site’s Title tag. For instance ‘UK’.

The problem being  that joomla title tag just uses the pages title for the tag. Like say Product Name. Which is a start i suppose. And yes that is having  turned on  the SEO friendly stuff  in  global and activated the .htaccess file.

Anyway, to make it ‘Product Name’ plus ‘some useful keywords’ in  the title tag i found this:

libraries/joomla/document/html/renderer/head.php

line 85:

$strHtml .= $tab.’<title>’.htmlspecialchars($document->getTitle()).’</title>’.$lnEnd;

and changed it to:

$strHtml .= $tab.’<title>’.htmlspecialchars($document->getTitle()).’ my additional keywords</title>’.$lnEnd;

and uploaded it – and hey presto it works.

This is for Joomla 1.5.17.

Note the space before my – ie ‘ my.

Upgrading to PHP 5 solves CMS problems

May 20th, 2010

And yet again upgrading  the hosts ( heart) to php5 has saved my bacon. First with megento, and now with a particularly heavy Joomla ecommerce template from Rockettheme.

Luckily its quite easy with Heart. You  add this line to an .htaccess file:

SetEnv DEFAULT_PHP_VERSION 5
php_flag short_open_tag on

and upload it.

Another nice trick is to add more memory from the default and though measily its usually enough, 8mb to 32, 64 or 126 by adding  this:

memory_limit = 128M

to a file named php.ini and uploading  it to above the public_html folder. Again seems to rescue many a random  problem.

DL lists and WordPress

May 20th, 2010

Found a nice post on  formatting DL lists here which is useful. I often want to get a list in line like example 2 and can spend far too long trying  to get it right myself.

so, to edit it a bit, here’s my reminder to me:

dl {}
dt {
float: left;
clear: left;
width: 100px;
text-align: right;
font-weight: bold;
color: #cccccc;
}
dt:after {
content: ":";
}
dd {
margin: 0 0 0 110px;
padding: 0 0 0.5em 0;
}

Example to follow – once i have a template and stylesheet sorted.

I do like the : after. Not that it works in  IE 6 of course. not tried in  IE 7 yet.

As i use IEs4Linux its a little vague anyway. Must remember to update it – might work better. ( at the moment the arrow pointer disappears over both IE6 and IE 7 which makes life little difficult).

AND, that’s my first use of the ‘code’ tag . Is it sad i can still get a little bit pleased about that? Oh damn it doesn’t work for <code></code>. Had to use &#60; &#62;! I think i have just cracked an HTML joke. Thats so sad.