Skip to content

Your own code in the right place

Code Snippets

Code Snippets adds CSS, JavaScript, HTML and PHP where it belongs – with safe PHP that cannot crash the website. Pro controls when and where the code runs.

  • Free to use
  • Works fully without Pro
  • Prowhen you want more

In WordPress the plugin is called Datoden Code Snippets – in the DT-addons menu it is listed as DT-code.

Snippets with conditions and timingCode snippets in a list, conditions for pages, visitors and device, a time period and earlier versions with Restore.SnippetsCSSSofter buttonsJSGoogle Tag ManagerHTMLChristmas bannerPHPHide the WP versionChristmas bannerWhenProFront page onlyMobileLogged outTimePro1 Dec → 6 Jan, every yearEarlier versionsProtoday 09:4212 linesRestoreyesterday 16:059 linesRestore
CSS, JavaScript, HTML and PHP in the right place – with Pro only on chosen pages, for chosen visitors, at a chosen time.

How Code Snippets works

DT-code adds your own CSS, JavaScript, HTML and PHP to the website without touching the theme. Each snippet has a type, a place where it is added and an on/off switch. Changes are saved as you type and show on the site right away.

All snippets in one list

Under Snippets you see every snippet with its type, place and an on/off switch. You can search, filter by CSS, JavaScript, HTML or PHP, and duplicate a snippet.

Choose where the code goes

Under Where you pick a place such as In the head, Right after <body>, In the footer, Before or After the content, Run everywhere, or places in the admin. With Only with the shortcode, the snippet appears wherever you add its shortcode in a page, post or widget.

Safe PHP

PHP is checked before it runs. If something is wrong, the website keeps using the last version that worked and the editor shows the error and the line. If a PHP snippet stops with an error on the website, only that snippet is paused.

Safe mode

If you cannot reach the admin, add define('DT_CODE_SAFE', true); to wp-config.php. No PHP snippets run until you remove the line.

Move from WPCode

If the site has WPCode, the Move from WPCode card appears. The code, type, place, priority and on/off state all come along. Snippets that are active in WPCode are imported switched off so nothing runs twice, and one click then turns WPCode off and them on.

Conditions: pages, visitors, device and language Pro

Under When you choose Only the pages I choose or All pages except the ones I choose, Logged in or Logged out visitors, Computer or Mobile and, on a multilingual site, a language. Page choices apply to places where the page is known.

Scheduling Pro

Under Time, choose Between dates and set a start and end. Turn on Every year to repeat it, for example a Christmas look from 1 December to 6 January.

Earlier versions Pro

While you edit, a version is kept at most every ten minutes. Under Earlier versions, click Bring back to put older code back in the editor.

What it looks like

Everything without a Pro label works for free. What is marked Pro is included in the Pro version.

Conditions for a snippetThe box When for the snippet Conversion code: only on two chosen pages, only for logged-out visitors, on all devices and only in Swedish.Conversion codeJSWhenProPagesOnly the pages I chooseThank you for your order/thank-you/Checkout/checkout/Cart/cart/VisitorsEveryoneLogged inLogged outDeviceAllComputerMobileLanguageAllSVEN
The code only where it is needed – with Pro you choose pages, visitors, device and language for each snippet.
An error in PHP – the website keeps goingThe editor with a PHP snippet where line 4 has an error, a message that the website keeps using the last version that worked, and earlier versions with Bring back.Hide the WP versionPHPError on line 41// Hide the WordPress version2remove_action('wp_head', 'wp_generator');3add_filter('the_generator',4'__return_empty_string')Where: Run everywhereEarlierversionsPro13 Oct 09:42Bring back12 Oct 16:05Bring back2 Oct 11:18Bring backLine 4: syntax error, unexpected end of fileThe website keeps using the last version that worked until the error is fixed.
An error in PHP does not take the website down – and with Pro you bring back an earlier version with one click.
All snippetsThe list Snippets with search and a filter for type, and five snippets with place, conditions and states such as Not now (time) and Error on line 4.Snippets+ New snippetSearch snippets…AllCSSJavaScriptHTMLPHPCSSSofter buttonsIn the headJSGoogle Tag ManagerIn the head · Logged outProHTMLChristmas bannerBefore the content · 1 Dec – 6 Jan every yearNot now (time)PHPHide the WP versionRun everywhereError on line 4CSSPrinting receiptsOnly with the shortcode · [datoden_code id="27"]
All snippets in one place – search, filter by type and see at once where they run, when they wait and if something is wrong.
Move from WPCodeThree snippets imported from WPCode with type and place, two waiting for WPCode to be turned off, and the button Turn off WPCode and turn them on.Move from WPCodeTurn off WPCode and turn them onEverything in WPCode is importedThe code, the type, the place, the priority and on/off came along.JSGoogle Analytics 4Header (from WPCode)Waits for WPCode to be turned offPHPDelivery timeRun everywhereWaits for WPCode to be turned offCSSOld campaign colourIn the head2 imported snippets wait to be turned on.Shortcodes like [wpcode id="12"] keep working.
Switch from WPCode without anything running twice – the snippets come along and are turned on with one click, in both free and Pro.

Get started

After installing – how to set up Code Snippets.

  1. Open DT-code

    Go to DT-addons → DT-code in the WordPress menu. If you use WPCode, you can start with Import from WPCode.

  2. Create a snippet

    Click New snippet, give it a name and choose a type: CSS, JavaScript, HTML or PHP. Write PHP without <?php at the start.

  3. Choose a place

    Under Where, pick where the code should go – for example In the head for CSS and tracking codes.

  4. Switch it on

    Turn on the On switch. The snippet is saved automatically and shows on the site straight away.

Free and Pro

Pro builds on the free version – it stays as the base, with all your settings, and Pro adds the rest.

Free

  • CSS, JavaScript, HTML and PHP
  • Chosen locations (head, footer, admin …)
  • Safe PHP
  • Move from WPCode

Code Snippets Pro

Everything in the free version, plus:

  • Conditions: pages, logged-in users, device and language
  • Scheduling
  • Earlier versions to go back to

Prices

Choose how many websites and how you want to buy. Prices exclude VAT – VAT is calculated at checkout.

Number of websites
One plugin €9€19€59one-off
  • Yours forever
  • Every update in the major version (e.g. 1.x)
  • A discount on the next major version
Recommended Subscription €8€17€25per month €99€199€299 per year – billed yearly €13€25€43per month
  • Every Pro plugin – new ones included as they arrive
  • Always the latest version, new major versions included
  • Plus Website Guard Pro: safe updates
  • Cancel any time
All Pro plugins €109€219€469one-off
  • Every plugin in one purchase – the most for your money
  • Plus Website Guard Pro: safe updates
  • Yours forever
  • Every update in the major version

* Up to 100 websites. Datoden may end a subscription and then refunds the remaining part of the paid period.

You sign in to your Datoden account (or create one for free) and pay securely at Stripe by card. Receipt and invoice are emailed right away.

Buy and install Pro

The licence follows your Datoden account – no key to paste.

  1. Buy

    The purchase is saved on your Datoden account as soon as the payment has gone through.

  2. Download

    Get the Pro plugin under My account → My purchases → Licences.

  3. Install

    Drop the zip file on Website Guard. Pro is added on top of the free version – everything you have done stays.

  4. Connect

    Connect the website in Website Guard. The Pro updates then arrive as ordinary WordPress updates.

Frequently asked questions

Who can change the code?

Administrators who are allowed to add unfiltered HTML. On a multisite network, that means super admins.

What if a PHP snippet has an error?

The editor shows the error and the line number, and the site keeps running the last version that worked. If the snippet stops on the website, only that snippet is paused.

Do my WPCode shortcodes still work after the move?

Yes. Shortcodes like [wpcode id="12"] keep working when WPCode is turned off.

Do I need to clear the cache?

No. The page cache is cleared for you when you change a snippet.

In what order do several snippets in the same place run?

Set Priority under More. Lower numbers run first; the default is 10.

What happens when a licence runs out?

Nothing stops working. A purchase never runs out, and when a subscription ends the plugins keep every function – only the updates from Datoden stop.

What is a major version?

The first number in the version. A purchase includes every update in that major version, for example all 1.x versions. A new major version (2.0) comes about once a year with clearly new features and comes at a discount as an upgrade. A subscription always includes it.

How are websites counted?

Websites connected to your Datoden account with a Pro plugin switched on, in the order they were connected. Disconnect a website in My websites to move the licence to another.

Do I need a licence key?

No. The website is connected to your Datoden account with Website Guard, and Datoden knows which updates your licences include.

Can I go back to the free version?

Yes. Deactivate Pro – the free version keeps running with the same settings. Functions that only exist in Pro stop, but nothing is deleted.

Do I keep the free version?

Yes. Pro is an add-on: the free version stays installed and active as the base and is updated from WordPress.org as usual, and Pro adds the Pro features on top. On WordPress.org the free versions are called Datoden …, for example Datoden Code Snippets.

Is VAT included?

Prices exclude VAT. VAT is calculated at checkout from your country. Companies in other EU countries can enter their VAT number.

Already bought?

Your licences, websites and downloads are under My account → My purchases → Licences.