Kopiere den PHP-Code unten, lege ihn als Plugin ab – dann kannst du jedes Import4u-Tool per Shortcode in deine Blog-Artikel einbinden. Kein Download nötig.
<?php
/**
* Plugin Name: Import4u Free Tools
* Plugin URI: https://import-4u.com/kostenlose-tools
* Description: Embeds free Import4u compliance, customs and logistics tools via shortcode. SEO-friendly: keeps a visible do-follow source link to import-4u.com.
* Version: 1.0.0
* Author: Import4u
* Author URI: https://import-4u.com
* License: GPLv2 or later
* Text Domain: import4u-tools
*
* Usage:
* [import4u tool="zollrechner-de" lang="de" height="720"]
* [import4u tool="ce-kennzeichnung-check" lang="en"]
*/
if ( ! defined( 'ABSPATH' ) ) { exit; }
define( 'IMPORT4U_TOOLS_VERSION', '1.0.0' );
define( 'IMPORT4U_TOOLS_BASE', 'https://import-4u.com' );
function import4u_tools_shortcode( $atts ) {
$atts = shortcode_atts( array(
'tool' => '',
'lang' => 'en',
'height' => '720',
'title' => '',
), $atts, 'import4u' );
$slug = sanitize_title( $atts['tool'] );
if ( '' === $slug ) {
return '<p class="import4u-error">[import4u] Attribut "tool" fehlt. Slugs: https://import-4u.com/kostenlose-tools</p>';
}
$allowed_langs = array( 'de', 'en', 'zh' );
$lang = in_array( $atts['lang'], $allowed_langs, true ) ? $atts['lang'] : 'en';
$height = max( 400, absint( $atts['height'] ? $atts['height'] : 720 ) );
$title_text = sanitize_text_field( $atts['title'] );
$embed_url = esc_url( IMPORT4U_TOOLS_BASE . '/embed/tool/' . $slug . '?lang=' . $lang );
$tool_url = esc_url( IMPORT4U_TOOLS_BASE . '/kostenloses-tool/' . $slug . '?lang=' . $lang );
$brand_url = esc_url( IMPORT4U_TOOLS_BASE );
$anchor = $title_text ? esc_html( $title_text ) : 'Import4u Tool';
static $registered = false;
if ( ! $registered ) {
add_action( 'wp_footer', 'import4u_tools_enqueue_loader' );
$registered = true;
}
ob_start();
?>
<span class="import4u-tool-embed" data-slug="<?php echo esc_attr( $slug ); ?>">
<span class="import4u-tool-embed__frame" style="position:relative;display:block;width:100%;max-width:760px;margin:0 auto;border-radius:14px;overflow:hidden;box-shadow:0 4px 20px rgba(0,0,0,.08);">
<iframe src="<?php echo $embed_url; ?>"
width="100%"
height="<?php echo esc_attr( $height ); ?>"
style="width:100%;height:<?php echo esc_attr( $height ); ?>px;border:0;display:block;"
loading="lazy"
referrerpolicy="no-referrer-when-downgrade"
title="<?php echo esc_attr( $anchor ); ?>"></iframe>
</span>
<p class="import4u-tool-embed__credit" style="text-align:center;font-size:13px;margin:10px 0 0;font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;color:#374151;">
<a href="<?php echo $tool_url; ?>" target="_blank" rel="noopener noreferrer" style="font-weight:600;color:#111;text-decoration:none;"><?php echo $anchor; ?></a>
– Powered by
<a href="<?php echo $brand_url; ?>" target="_blank" rel="noopener noreferrer" style="font-weight:700;color:#ca8a04;text-decoration:none;">Import4u</a>
</p>
</span>
<?php
return ob_get_clean();
}
add_shortcode( 'import4u', 'import4u_tools_shortcode' );
function import4u_tools_enqueue_loader() {
wp_enqueue_script(
'import4u-tools-embed',
IMPORT4U_TOOLS_BASE . '/embed.js',
array(),
IMPORT4U_TOOLS_VERSION,
true
);
}toolPflichtTool-Slug (Pflicht) – siehe Embed Hublangde / en / zh (Standard: en)heightHöhe in px (Standard: 720, min: 400)titleEigener Link-Text (SEO-Tipp)Das Plugin setzt einen sichtbaren „Powered by Import4u"-Link unter jedem Tool. Das ist die einzige Bedingung für die kostenlose Nutzung.