Leveraging AI to Supercharge Your WordPress Business Website
In today’s competitive digital landscape, every business website needs an edge to...
26.Sep.2022 | Code Snippets, Stuff i like, Wordpress
You can use the following method in php to create a conditional that checks if a url has http or https.
Using parse_url() on a url string creates an array.
$url = parse_url($your_url);
You can then use $url[‘scheme’] in an if statement to check for http or https.
Full code below. Update the $your_url variable to your required url source.
<?php
$your_url = 'https://www.website.co.uk';
$url = parse_url($your_url);
if ( $url['scheme'] == 'https' ) :
// Do something if url has https...
endif;
?>Share

In today’s competitive digital landscape, every business website needs an edge to...

WordPress has come a long way since its humble beginnings in 2003....

In the ever-evolving landscape of website development, staying ahead of the curve...
To stop any page from being deleted by any user role, including admins, add the following code to your functions.php...
I came across this when looking for a purpose built, fully customisable calendar - https://fullcalendar.io/ Im just starting to work with...
A quick snipped of code filter parameters into YouTube oEmbed requests. Handy to remove suggested videos, YouTube contols and info....