Code Snippets

The quickest way to use this section is to search using a search term.

Have you contributed your favorite snippets yet? Check your submissions using the link attached to your welcome message in the header.

Snippets include php, javascript or css code to help customise your site. If you wish to add some helpful bits of code you can submit it here for review. All contributions welcome!

Language:           Keyword:             
Embed video in Custom Page Template using ACF
Create an ACF URL Field (eg "video_link" ) Then use this code to add it anywhere in a page template. The code checks if there is a value, then stores that value as a variable (for easier use), then it stores the completed shortcode as a variable . It finally displays the output of the shortcode.
See this code in use here: 
Submitted by: jmacreations
Language: PHP

Add Cart with Item Count in Menu
Add this to your child theme functions.php file.
See this code in use here: 
Submitted by: Donald McGuinn
Language: PHP

Fade Fixed Navbar on scroll
See this code in use here: 
Submitted by: x.sirc
Language: JavaScript

SSL your site in 2 minutes
1. In CPanel file manager - use .htaccess to force SSL from http: 2. Simply copy a backup and name it .htaccess-preSSL 3. in .htaccess in the editor ADD this text and the correct DOMAIN.XX or it will redirect to the wrong one (or XXX a 404) 4. Copy and paste from # to the [L] so nothing is missed - then forces SSL 5. smile - job done. and if any issues resort to your backup .htaccess til u figure it out what u did wrong. Save the erroneous one as .htaccess-postSSL-stuffup till u get it right
See this code in use here: 
Submitted by: XAdmin
Language: htaccess

Horizontally Centre Footer Widgets Inside Container
This works on 3 or less widgets, have not tried 4 as yet.
See this code in use here: 
Submitted by: XAdmin
Language: CSS

CSS : target internet explorer
I found out that some SVG files and svg code doesnt display correctly on internet explorer . so I started looking for a way to add css style only for internet explorer in x-theme. Maybe this is not the right approach but this is the best way I found. And I tried alot of options 🙂 As always, you need to change the green to your setup 🙂
See this code in use here: 
Submitted by: baroninn
Language: CSS

Edit Focus Border
Remove focus border surrounding buttons on click.
See this code in use here: 
Submitted by: Martin Mosley
Language: CSS

CSS – Section Slope
Adjust as necessary. Just add the class "slope" to whatever section you to apply this to.
See this code in use here: 
Submitted by: XAdmin
Language: CSS

Customize the wp-login page
There are multiple ways to customize the wp-login page, and one of it is using the White Lable CMS plugin which plays nice along with X-theme. It doesn't feature Wysiwig editor. Instead, it accepts CSS so I have wrote a user-friendly version with comments for my own reference which I have decided to share. 🙂 The logo can be changed from the admin panel of the plugin.
See this code in use here: 
Submitted by: Miroslav Meduric
Language: CSS

Rotating Logo
See this code in use here: 
Submitted by: Martin Mosley
Language: CSS