codehaven - php snippets - coding help
Generic filters
Exact matches only

Firefox 89-100 (2022) Tabs on top/bottom not working fixed again

Firefox - Codehaven

NEW UPDATE MAY 2023 – FIREFOX 113 https://www.codehaven.co.uk/firefox/firefox-113-2023-tabs-on-top-bottom-not-working-fixed-again/   The following version Works with Firefox version 100 – May 2022 onwards Make the Browser Tabs appear at the Top You use the tabs far much more than the URL bar, so it makes sense, and saves many miles on your mouse. Put the tabs nearer, […]

Flip Div using Css3

Css - Codehaven

When hovering over an image it will use the CSS to implement an image flip.

Firefox 113 (2023) Tabs on top/bottom not working fixed again

Firefox - Codehaven

Again they have updated Firefox and screwed up the changes made last time to keep the tabs underneath the url. Fortunately its a quick fix. Search your userChrome.css for the following two lines and replace. 1. Replace

With

2. Replace

With

Close Firefox, and restart. Thanks to u/hasaan5 (reddit for that) […]

Only accept numbers less than 100 for textbox – Jquery

jquery icon

Percentage

php codehaven

To find 30% of a variable

Most of the time is *100, but here it is…..

Redirect WordPress if url contains a specific directory

wordpress category

This can be a tricky one! Redirecting using .htaccess can be hit and miss at the best of times. If you want to redirect any url that contains a specific text without wordpress then that code snippet is here. But add to that the nature of WordPress and cache it can be a nightmare. But […]

How to Solve the Worlds Problems – In a Day!

codehaven code snippet review

Interesting Maths I have been doing some maths and found the following interesting…. Billionaires that give away their money within their lifetime, they sign up to a Pledge. ‘Pledgers’ to commit to giving away at least half their fortunes during their lifetimes or upon their deaths. The Giving Pledge, was begun by Warren Buffett and […]

Make a Footer Stick to the Bottom of the Page

Css - Codehaven

How to Enable and Use Coupons in WooCommerce

woocommerce category codehaven

1. To enable Coupons find the “Enable the use of coupon codes” (It can be in different places depending on the versions of WooCommerce you have)   2. Refresh your page and you will see that Coupons have been added to the menu   3. You will then see a welcome page to coupons   […]

Create a plugin with shortcode for Elementor – Most basic ever!

wordpress category

1. Save this code below as rawcode.php

2. Create a folder in the plugins folder called the same – “rawcode” (\wp-content\plugins\rawcode) 3. This will now show up as a plugin. Activate it. 4. In a page or post within elementor (or without) add the following shortcode. [rawcode-plugin-demo] 5. It will now appear in the […]

Responsive Video for YouTube

Css - Codehaven

This will make your youtube video fully responsive….

Make Iframe with Javascript

javascript category codehaven

To make it append to a div called container (id) use this

And here we have an iframe that can switch between replacing the contents each time

If you need to remove iframe border then

Center text in middle of page

Css - Codehaven

Anchor position going to far down the page

Css - Codehaven

If your anchor goes to far down the page, use this code it does not affect anything other than the actual position of where the anchor stops. If you have an anchor id of ‘latest’ so you click on it /mysite/#latest as the link the ID is labelled as ‘latest’ and add this css below. […]

Gradient Background

Css - Codehaven

Google Says You Are Not Entitled to Links – Search Engine Journal

A recent exchange on Twitter between Rand Fishkin and Google’s Danny Sullivan highlighted the tension between Google and the SEO community regarding links.  This time it was over the idea of links to sources that are quoted by websites like news organizations. Are sources quoted by news organizations and other sites entitled to a do-follow […]

What does ‘background-size’ do in CSS?

Css - Codehaven

Some ways of using an image in a background.

Best Plugins to Compress Images for SEO

SEO category

WP image compression plugins, have always been hit and miss. Here I try to show you how to get the best SEO results for your website and what combination of plugins you should use. EWWW Image Optimizer plugin has always been my tool to cope with importing large images and compressing them. Sometimes I export […]

How to Fix Blurry Gallery Thumbnails in Woocommerce

woocommerce category codehaven

I had some really blurry gallery thumbnails in Woocommerce, using the Hello theme with Elementor. The images uploaded were of very high quality and so I read a few blog posts and found out about “Regenerate Thumbnails” plugin. So I thought I would give it a go. I installed then regenerated the thumbnails, and it […]

Fly to Cart effect

jquery icon

Amazon Reviews can’t be trusted – Thousands of fake reviews found

Amazon Logo

Amazon Fake Reviews When I ordered a mobile phone screen protector for my Samsung S8 plus, I fired up the Amazon app and started to search for a well made, good fitting and most importantly a product that has top reviews. Now what if I told you that thousands upon thousands of reviews are fake. […]

Switch / Swap/ Change Class or ID

Css - Codehaven

I changed the id called ‘touser’ to ‘dogs’ below

This changes the id of submit board to the class of submitboardnew. You can use id or class in this example.

You Want Google To Stay Stagnant & Not Improve? – Search Engine Roundtable

As you know, Google is making efforts to update their GoogleBot to crawl the more modern web. We reported it about it last week. But that bothered at least one SEO who complained that they worked on all these workarounds and now Google is going to ditch those workaround when this new GoogleBot goes live. […]

Canonicals – What the hell are they?

copy stamp

In a nutshell a canonical is used to tell Google where you got the content from originally. Imagine you had to do an essay, and when you handed that long 2000 word essay in – most of the work was Jeff’s. The tutor would mark you down nearly 100% and tell you off. this is […]

NEW Google Indexing Issue Ongoing Friday May 24 – Search Engine Journal

tweet

Late Thursday May 23, 2019, Google’s Webmasters Twitter account tweeted that Google is suffering a new indexing problem that is completely separate from the previous day’s indexing issue. Here is the text of the tweet: We’re looking into a new indexing issue that started escalating 6 hours ago. The issue is unrelated to yesterday’s outage […]

Redirect url that contains specific text or directory – .htaccess

random coding category codehaven

This is not for WordPress! If you want a way of redirecting if a url contains a directory then take a look here. If my website had a directory called dogs (/dogs/) in the URL, and I had 100 pages like this: – http://aq.gthex.co.uk:10000/dogs/page1/ http://aq.gthex.co.uk:10000/dogs/page2/ http://aq.gthex.co.uk:10000/dogs/page3/ I would not want to use a plugin to […]

Trim left Javascript text

javascript category codehaven

Simple way to trim whitespace for the beginning of text using JavaScript.

Output = “Hi ” To replace all whitespace using Javascript use this next script. http://aq.gthex.co.uk:10000/javascript/trim-whitespace-javascript/

Passive Earning – Hi Dollars Crypto App

hilogo

earn Passive income with the hi Dollars App Start earning now Invite only ‘hi Dollars’ – Start earning passive income £25 P/M for clicking a button This simple app is a great starter for those who want to start into the cryptocurrency world without actually having to use any money. You can earn money by […]

Sticky header – Logo smaller and adds border on scroll

Css - Codehaven

This is purely code just to apply a logo shrink on scroll and also applies a border on the bottom of the header using elementor. Make sure you add the id of the logo to #mylogo, and the header section add the ID of #myheader. Then add the code below to the section css in […]

Vary: User-Agent in WordPress – SEO

vary agent with gun man

When performing a gtmetrix test (gtmetrix) you may see a problem under the Vary: Accept-Encoding area. There are a few ways to fix this, firstly you can use Cloudflare(CDN) that does it automatically. Another way of solving this is adding it to you .htaccess file directly or adding it to your functions.php file if your […]

Random numbers and string

php codehaven

Just numbers

and both numbers and letters

DNS settings – Cloudflare, OpendDns and Google

windows-codehaven

What are some popular DNS options besides my ISP’s default? Google Public DNS: Primary: 8.8.8.8 Secondary: 8.8.4.4 OpenDNS Primary: 208.67.222.222 Secondary: 208.67.220.220 Cloudflare Primary: 1.1.1.1 Secondary: 1.0.0.1 Maybe you want to Add Dynamic DNS to your Router with FreeDNS

replacewith – change div onclick

jquery icon

Text file Read – Create – Save write/delete fopen

php codehaven

Read text file

Create a text file and add 122 to the file and save it

Basic write to text file

New file name Creates a new file with the milliseconds time (Filenumber-1232233223.txt)

When run, this creates a text file (you may need permissions to write), the ‘a’ stands for append […]

Show only 2 decimal places

php codehaven

Two ways of doing this…be careful…. Best way ..

This now shows 123.00 (it has added two decimal places as zeros, to make up the number) Second way …. (not as good, as it rounds up to 2 decimal places)

This will show 23.12 (and can be added to another number) But…..if the […]