The Definitive Guide to Setting Up WordPress in 2024: A Bristol Freelance Web Developer’s Essential Setup
In the ever-evolving landscape of website development, staying ahead of the curve...
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 the ever-evolving landscape of website development, staying ahead of the curve...
In the digital realm, your website serves as the cornerstone of your...
In the ever-evolving world of e-commerce, having a robust and flexible platform...
A quick way to remove empty p tags from custom shortcodes in Wordpress. <?php add_filter("the_content", "the_content_filter"); function the_content_filter($content) { $block...
In today's digital age, having a strong online presence is crucial for businesses. When it comes to building a website,...
Handy bit of code you can use in your custom templates that grabs the all the page or post data by ID:...