<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Wordpress Code News Kategorie - Homepage-nach-Preis</title>
	<atom:link href="https://homepage-nach-preis.de/thema/wordpress-codes/feed/" rel="self" type="application/rss+xml" />
	<link>https://homepage-nach-preis.de/thema/wordpress-codes/</link>
	<description>★ Responsive Webdesigner Homepage erstellen lassen, bereits ab 299 Euro professionelle Webseite. ✓ Google-Optimiert ✓ Mobil-Optimiert &#124; Webdesign &#38; Seo</description>
	<lastBuildDate>Wed, 22 May 2024 13:06:58 +0000</lastBuildDate>
	<language>de</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://homepage-nach-preis.de/wp-content/uploads/2021/02/cropped-icon-150x150.png</url>
	<title>Wordpress Code News Kategorie - Homepage-nach-Preis</title>
	<link>https://homepage-nach-preis.de/thema/wordpress-codes/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>WordPress Rest API Schnittstelle mit Firewall</title>
		<link>https://homepage-nach-preis.de/2024/05/22/wordpress-rest-api-schnittstelle-mit-firewall/</link>
					<comments>https://homepage-nach-preis.de/2024/05/22/wordpress-rest-api-schnittstelle-mit-firewall/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Wed, 22 May 2024 12:41:18 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Schnitstelle]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8247</guid>

					<description><![CDATA[<p>Registrierung der benutzerdefinierten REST-Route Die Funktion zur Registrierung der REST-API-Route wird verwendet, um einen neuen Endpunkt in WordPress hinzuzuf&#xFC;gen. Dieser Endpunkt erm&#xF6;glicht es, externe Anfragen an WordPress zu senden und eine Antwort zu erhalten. Schritte der Registrierung: Hook zur Initialisierung der REST-API: Mit add_action(&#x27;rest_api_init&#x27;, function () { &#8230; }); wird eine anonyme Funktion registriert, die w&#xE4;hrend der Initialisierung der REST-API aufgerufen wird. Definition der Route: Innerhalb dieser anonymen Funktion wird register_rest_route aufgerufen, um die Route zu definieren. Namespace: &#x27;hnp_api_firewall/v1&#x27; legt den Namespace fest, der als Versionierung der API dient. Route: &#x27;/api&#x27; ist der spezifische Endpunkt innerhalb des Namespace. Optionen: Ein Array von Optionen, darunter: Methode: &#x27;methods&#x27; =&#x3E; &#x27;POST&#x27; spezifiziert, dass die Route nur POST-Anfragen akzeptiert. Callback: &#x27;callback&#x27; =&#x3E; &#x27;hnp_api_firewall_callback&#x27; gibt die Funktion an, die aufgerufen wird, wenn die Route erreicht wird. Berechtigung: &#x27;permission_callback&#x27; =&#x3E; &#x27;hnp_api_firewall_combined_permissions&#x27; bestimmt die Funktion, die die Berechtigungen f&#xFC;r den Zugriff auf die Route &#xFC;berpr&#xFC;ft. Kombinierte Berechtigungs- und Blockierungslogik Die Funktion hnp_api_firewall_combined_permissions dient dazu, die Berechtigungen und Blockierungslogik zu kombinieren. Sie wird aufgerufen, bevor die Haupt-Callback-Funktion ausgef&#xFC;hrt wird, um sicherzustellen, dass nur berechtigte Anfragen zugelassen werden. Schritte der Berechtigungspr&#xFC;fung: IP-&#xDC;berpr&#xFC;fung: Die IP-Adresse des Anfragenden wird &#xFC;berpr&#xFC;ft, um festzustellen, ob sie blockiert ist. Wenn die IP-Adresse blockiert ist....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/05/22/wordpress-rest-api-schnittstelle-mit-firewall/">WordPress Rest API Schnittstelle mit Firewall</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong><br />
Registrierung der benutzerdefinierten REST-Route</strong></p>
<p>Die Funktion zur Registrierung der REST-API-Route wird verwendet, um einen neuen Endpunkt in WordPress hinzuzuf&#xFC;gen. Dieser Endpunkt erm&#xF6;glicht es, externe Anfragen an WordPress zu senden und eine Antwort zu erhalten.</p>
<p><strong>Schritte der Registrierung:</strong></p>
<p>    Hook zur Initialisierung der REST-API: Mit add_action(&#x27;rest_api_init&#x27;, function () { &#8230; }); wird eine anonyme Funktion registriert, die w&#xE4;hrend der Initialisierung der REST-API aufgerufen wird.<br />
    Definition der Route: Innerhalb dieser anonymen Funktion wird register_rest_route aufgerufen, um die Route zu definieren.<br />
        Namespace: &#x27;hnp_api_firewall/v1&#x27; legt den Namespace fest, der als Versionierung der API dient.<br />
        Route: &#x27;/api&#x27; ist der spezifische Endpunkt innerhalb des Namespace.<br />
        Optionen: Ein Array von Optionen, darunter:<br />
            Methode: &#x27;methods&#x27; =&#x3E; &#x27;POST&#x27; spezifiziert, dass die Route nur POST-Anfragen akzeptiert.<br />
            Callback: &#x27;callback&#x27; =&#x3E; &#x27;hnp_api_firewall_callback&#x27; gibt die Funktion an, die aufgerufen wird, wenn die Route erreicht wird.<br />
            Berechtigung: &#x27;permission_callback&#x27; =&#x3E; &#x27;hnp_api_firewall_combined_permissions&#x27; bestimmt die Funktion, die die Berechtigungen f&#xFC;r den Zugriff auf die Route &#xFC;berpr&#xFC;ft.</p>
<p><strong>Kombinierte Berechtigungs- und Blockierungslogik</strong></p>
<p>Die Funktion hnp_api_firewall_combined_permissions dient dazu, die Berechtigungen und Blockierungslogik zu kombinieren. Sie wird aufgerufen, bevor die Haupt-Callback-Funktion ausgef&#xFC;hrt wird, um sicherzustellen, dass nur berechtigte Anfragen zugelassen werden.</p>
<p><strong>Schritte der Berechtigungspr&#xFC;fung:</strong></p>
<p>    IP-&#xDC;berpr&#xFC;fung: Die IP-Adresse des Anfragenden wird &#xFC;berpr&#xFC;ft, um festzustellen, ob sie blockiert ist.<br />
        Wenn die IP-Adresse blockiert ist und die Blockierungsdauer noch nicht abgelaufen ist, wird der Zugriff verweigert.<br />
        Wenn die Blockierungsdauer abgelaufen ist, wird die IP-Adresse entsperrt und die Blockierungsinformationen werden zur&#xFC;ckgesetzt.</p>
<p>    &#xDC;berpr&#xFC;fung der API-Benutzer und -Geheimnisse: Die Kopfzeilen der Anfrage werden auf g&#xFC;ltige API-Benutzer und -Geheimnisse &#xFC;berpr&#xFC;ft.<br />
        Wenn die Anmeldedaten korrekt sind, wird der Z&#xE4;hler f&#xFC;r g&#xFC;ltige Versuche erh&#xF6;ht.<br />
        Wenn die Anmeldedaten falsch sind, wird der Z&#xE4;hler f&#xFC;r ung&#xFC;ltige Versuche erh&#xF6;ht.<br />
            Wenn die Anzahl ung&#xFC;ltiger Versuche einen bestimmten Schwellenwert &#xFC;berschreitet (z.B. 50), wird die IP-Adresse blockiert.</p>
<p>    Versuchsverfolgung: Die Anzahl der erfolgreichen und fehlgeschlagenen Anmeldeversuche wird verfolgt, um die Blockierungslogik zu unterst&#xFC;tzen.</p>
<p><strong>R&#xFC;ckgabewert</strong></p>
<p>    Erfolgreiche Berechtigung: Wenn die Berechtigung erfolgreich ist, gibt die Funktion true zur&#xFC;ck, wodurch die Haupt-Callback-Funktion hnp_api_firewall_callback aufgerufen wird.<br />
    Fehlgeschlagene Berechtigung: Wenn die Berechtigung fehlschl&#xE4;gt, wird ein Fehler zur&#xFC;ckgegeben und die Haupt-Callback-Funktion wird nicht ausgef&#xFC;hrt.</p>
<p><strong>Haupt-Callback-Funktion</strong></p>
<p>Die Haupt-Callback-Funktion hnp_api_firewall_callback wird aufgerufen, wenn die Berechtigung erfolgreich ist und die Route erreicht wird. Sie gibt eine JSON-Antwort mit dem Dateninhalt zur&#xFC;ck, der in diesem Fall ein einfaches Beispiel mit {&#x22;testdata&#x22;: &#x22;test&#x22;} ist.</p>
<pre>

// Register the custom REST route
add_action(&#x27;rest_api_init&#x27;, function () {
    register_rest_route(&#x27;hnp_api_firewall/v1&#x27;, &#x27;/api&#x27;, array(
        &#x27;methods&#x27; =&#x3E; &#x27;POST&#x27;,
        &#x27;callback&#x27; =&#x3E; &#x27;hnp_api_firewall_callback&#x27;,
        &#x27;permission_callback&#x27; =&#x3E; &#x27;hnp_api_firewall_combined_permissions&#x27;,
    ));
});

// Combined function to handle permissions and blocking logic
function hnp_api_firewall_combined_permissions(WP_REST_Request $request) {
    $ip_address = sanitize_text_field($_SERVER[&#x27;REMOTE_ADDR&#x27;]);
    $blocked_ips = get_option(&#x27;hnp_blocked_ips&#x27;, array());

    // Check if IP is blocked
    if (isset($blocked_ips[$ip_address])) {
        $block_info = $blocked_ips[$ip_address];
        $block_time = $block_info[&#x27;block_time&#x27;];
        $block_duration = $block_info[&#x27;block_duration&#x27;];
        $current_time = current_time(&#x27;timestamp&#x27;);

        // If current time is less than block time + block duration, deny access
        if ($current_time &#x3C; ($block_time + $block_duration)) {
            return new WP_Error(&#x27;blocked_ip&#x27;, &#x27;Your IP is temporarily blocked due to too many attempts.&#x27;, array(&#x27;status&#x27; =&#x3E; 403));
        } else {
            // Unblock IP and reset attempts after block duration
            unset($blocked_ips[$ip_address]);
            update_option(&#x27;hnp_blocked_ips&#x27;, $blocked_ips);
        }
    }

    // Check API user and secret
    $api_user = $request-&#x3E;get_header(&#x27;APIUser&#x27;);
    $api_secret = $request-&#x3E;get_header(&#x27;APISecret&#x27;);
    $valid_api_user = &#x27;4GI53seaRLu!FK9XEiAk323U6M!f2bT7Sda28ZqsaegQCn0!Y121Y1L&#x27;;
    $valid_api_secret = &#x27;091572EddV!YcTKGR3Q13a!CM6TN!UWbPqFRdwa1XpP!1g8o32aaJD4&#x27;;

    // Tracking attempts
    $attempts = get_option(&#x27;hnp_attempts&#x27;, array());

    if (!isset($attempts[$ip_address])) {
        $attempts[$ip_address] = array(
            &#x27;valid_count&#x27; =&#x3E; 0,
            &#x27;invalid_count&#x27; =&#x3E; 0,
            &#x27;invalid_license_count&#x27; =&#x3E; 0,
            &#x27;first_attempt_time&#x27; =&#x3E; current_time(&#x27;timestamp&#x27;)
        );
    }

    $permission_granted = null !== $api_user &#x26;&#x26; $api_user === $valid_api_user &#x26;&#x26; null !== $api_secret &#x26;&#x26; $api_secret === $valid_api_secret;

    if ($permission_granted) {
        $attempts[$ip_address][&#x27;valid_count&#x27;]++;
    } else {
        $attempts[$ip_address][&#x27;invalid_count&#x27;]++;

        // Block IP if invalid attempts exceed threshold (e.g., 50)
        if ($attempts[$ip_address][&#x27;invalid_count&#x27;] &#x3E;= 50) {
            $blocked_ips[$ip_address] = array(&#x27;block_time&#x27; =&#x3E; current_time(&#x27;timestamp&#x27;), &#x27;block_duration&#x27; =&#x3E; 12 * HOUR_IN_SECONDS);
            update_option(&#x27;hnp_blocked_ips&#x27;, $blocked_ips);
            return new WP_Error(&#x27;blocked_ip&#x27;, &#x27;Your IP is temporarily blocked due to too many invalid attempts for API Secret/Username.&#x27;, array(&#x27;status&#x27; =&#x3E; 403));
        }

        update_option(&#x27;hnp_attempts&#x27;, $attempts);
        return new WP_Error(&#x27;invalid_credentials&#x27;, &#x27;Invalid API Secret key or password.&#x27;, array(&#x27;status&#x27; =&#x3E; 403));
    }

    // Reset invalid attempts on successful authentication
    if (isset($attempts[$ip_address])) {
        unset($attempts[$ip_address][&#x27;invalid_count&#x27;]);
        update_option(&#x27;hnp_attempts&#x27;, $attempts);
    }

    return true;
}

function hnp_api_firewall_callback() {
    return new WP_REST_Response(array(
        &#x27;testdata&#x27; =&#x3E; &#x27;test&#x27;
    ), 200);
}

</pre>
<p><strong>cUrl Anfrage zum Testen:</strong></p>
<pre>
curl -X POST https://yourdomain.com/wp-json/hnp_api_firewall/v1/api \
     -H &#x22;APIUser: 4GI53seaRLu!FK9XEiAk323U6M!f2bT7Sda28ZqsaegQCn0!Y121Y1L&#x22; \
     -H &#x22;APISecret: 091572EddV!YcTKGR3Q13a!CM6TN!UWbPqFRdwa1XpP!1g8o32aaJD4&#x22;

</pre>
<p><strong>PHP Anfrage zum Testen:</strong></p>
<pre>
&#x3C;?php

function call_hnp_api_firewall() {
    $url = &#x27;https://yourdomain.com/wp-json/hnp_api_firewall/v1/api&#x27;;
    
    $args = array(
        &#x27;headers&#x27; =&#x3E; array(
            &#x27;APIUser&#x27; =&#x3E; &#x27;4GI53seaRLu!FK9XEiAk323U6M!f2bT7Sda28ZqsaegQCn0!Y121Y1L&#x27;,
            &#x27;APISecret&#x27; =&#x3E; &#x27;091572EddV!YcTKGR3Q13a!CM6TN!UWbPqFRdwa1XpP!1g8o32aaJD4&#x27;
        ),
        &#x27;body&#x27; =&#x3E; array(
            // Any additional data you want to send in the body
        )
    );

    $response = wp_remote_post($url, $args);

    if (is_wp_error($response)) {
        $error_message = $response-&#x3E;get_error_message();
        echo &#x22;Something went wrong: $error_message&#x22;;
    } else {
        $response_body = wp_remote_retrieve_body($response);
        echo &#x27;Response:&#x3C;br&#x3E;&#x27;;
        echo &#x27;&#x3C;pre&#x3E;&#x27;;
        print_r(json_decode($response_body, true));
        echo &#x27;&#x3C;/pre&#x3E;&#x27;;
    }
}

// Call the function
call_hnp_api_firewall();

?&#x3E;

</pre>
<p><strong>C# Anfrage zum Testen:</strong></p>
<pre>
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Threading.Tasks;

class Program
{
    private static async Task CallHnpApiFirewallAsync()
    {
        var url = &#x22;https://yourdomain.com/wp-json/hnp_api_firewall/v1/api&#x22;;
        
        using (var client = new HttpClient())
        {
            // Set the APIUser and APISecret headers
            client.DefaultRequestHeaders.Add(&#x22;APIUser&#x22;, &#x22;4GI53seaRLu!FK9XEiAk323U6M!f2bT7Sda28ZqsaegQCn0!Y121Y1L&#x22;);
            client.DefaultRequestHeaders.Add(&#x22;APISecret&#x22;, &#x22;091572EddV!YcTKGR3Q13a!CM6TN!UWbPqFRdwa1XpP!1g8o32aaJD4&#x22;);

            // Optionally set the content of the request (if needed)
            var content = new StringContent(&#x22;&#x22;, System.Text.Encoding.UTF8, &#x22;application/json&#x22;);

            try
            {
                var response = await client.PostAsync(url, content);

                if (response.IsSuccessStatusCode)
                {
                    var responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine(&#x22;Response:&#x22;);
                    Console.WriteLine(responseBody);
                }
                else
                {
                    Console.WriteLine($&#x22;Error: {response.StatusCode}&#x22;);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($&#x22;Exception: {ex.Message}&#x22;);
            }
        }
    }

    static void Main(string[] args)
    {
        Task.Run(() =&#x3E; CallHnpApiFirewallAsync()).GetAwaiter().GetResult();
    }
}

</pre>
<p><strong>Sicherheit:</strong></p>
<p>Anzahl der möglichen Kombinationen bei BrutForceAttacken</p>
<p>Einzelne Schlüssel:</p>
<p>Für einen einzelnen Schlüssel mit 50 Zeichen und 94 möglichen Zeichen pro Position ergibt sich:<br />
945094 hoch50<br />
Zwei Schlüssel kombiniert</p>
<p>Da beide Schlüssel unabhängig voneinander betrachtet werden, multiplizieren wir die Anzahl der möglichen Kombinationen beider Schlüssel:</p>
<p>(94 hoch50)×(94 hoch50)(94 hoch50)×(94 hoch50)</p>
<p><strong>Dies entspricht:</strong><br />
9410094 hoch100</p>
<p><strong>Zeit für einen Brute-Force-Angriff</strong></p>
<p>Angenommen, ein Computer kann 1 Milliarde (1.000.000.000) Kombinationen pro Sekunde testen:</p>
<p>    Anzahl der Kombinationen:<br />
        Die Anzahl der Kombinationen für einen Schlüssel: 945094 hoch50 (eine extrem große Zahl)<br />
        Die Anzahl der Kombinationen für beide Schlüssel: 9410094 hoch100 (noch viel größer)</p>
<p><strong>    Zeit für Brute-Force:</strong><br />
        Selbst wenn ein Computer 1 Milliarde Kombinationen pro Sekunde testen könnte, würde das Testen aller Kombinationen von zwei Schlüsseln extrem lange dauern.<br />
        Zum Vergleich:<br />
            Eine Milliarde Sekunden sind etwa 31,7 Jahre.</p>
<p><strong>            Die Anzahl der Kombinationen für 9410094 hoch100 ist so groß, dass selbst mit extrem schneller Hardware Billionen von Jahren benötigt würden, um alle Kombinationen zu testen.</strong></p>
<p><strong>Durch die Rate Limitierung der Firewall wird die Zeit auf Milliarden von Jahren erhöht, zudem sind DDOS oder ähnliche Hacking-Angriffe nicht möglich. Die Schnittstelle wird somit zusätzlich geschützt. </strong></p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/05/22/wordpress-rest-api-schnittstelle-mit-firewall/">WordPress Rest API Schnittstelle mit Firewall</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/05/22/wordpress-rest-api-schnittstelle-mit-firewall/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HNP Win Data Handler – Datenaustausch zwischen WordPress &#038; Windows</title>
		<link>https://homepage-nach-preis.de/2024/04/27/hnp-win-data-handler-datenaustausch-zwischen-wordpress-windows/</link>
					<comments>https://homepage-nach-preis.de/2024/04/27/hnp-win-data-handler-datenaustausch-zwischen-wordpress-windows/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Sat, 27 Apr 2024 13:27:14 +0000</pubDate>
				<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[HNP Win Data Handler]]></category>
		<category><![CDATA[Rest]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[Verbindung]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8223</guid>

					<description><![CDATA[<p>In einer Zeit, in der die Integration verschiedener Technologien zunehmend an Bedeutung gewinnt, bietet der &#8220;HNP Win Data Handler&#8221; eine effiziente Lösung für die sichere Datenübertragung zwischen einer WordPress-Website und einer externen C#-Anwendung. Dieses System stellt eine maßgeschneiderte REST API zur Verfügung, die speziell dafür entwickelt wurde, um von jeder C#-basierten Anwendung aus auf die Daten einer WordPress-Seite zuzugreifen. Was der HNP Win Data Handler macht Der HNP Win Data Handler ist ein WordPress-Plugin kombiniert mit einer C#-Anwendung, die zusammenarbeiten, um Daten sicher zu verwalten und auszutauschen. Das WordPress-Plugin definiert spezifische REST-API-Endpunkte, die es einer C#-Anwendung ermöglichen, Daten zu lesen (GET) und zu schreiben (POST). Diese Daten können für eine Vielzahl von Anwendungen nützlich sein, beispielsweise für das Abrufen und Aktualisieren von Konfigurationseinstellungen, Nutzerdaten oder anderen dynamischen Inhalten, die auf der WordPress-Seite gepflegt werden. Download Exe &#038; WordPress Plugin (sofort kostenlos nutzbar): [sdm_download id=&#8221;8231&#8243; fancy=&#8221;0&#8243;] Shortcode in WordPress für Anzeige der Daten: &#x5B;hnp_win_data_display] Github: https://github.com/HNP-Christopher-Rohde/Hnp-win-data-handler/tree/main C# Source-Code für die Win EXE / Anwendung: Die C#-Komponente handhabt die Benutzereingaben und interagiert direkt mit der REST-API. Sie bietet Funktionen zum Ändern der Domain-URL, zum Laden von Daten aus WordPress und zum Speichern von Änderungen an den Daten. Diese Flexibilität macht es möglich,....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/27/hnp-win-data-handler-datenaustausch-zwischen-wordpress-windows/">HNP Win Data Handler – Datenaustausch zwischen WordPress &#038; Windows</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In einer Zeit, in der die Integration verschiedener Technologien zunehmend an Bedeutung gewinnt, bietet der &#8220;HNP Win Data Handler&#8221; eine effiziente Lösung für die sichere Datenübertragung zwischen einer WordPress-Website und einer externen C#-Anwendung. Dieses System stellt eine maßgeschneiderte REST API zur Verfügung, die speziell dafür entwickelt wurde, um von jeder C#-basierten Anwendung aus auf die Daten einer WordPress-Seite zuzugreifen.</p>
<p><strong>Was der HNP Win Data Handler macht</strong></p>
<p>Der HNP Win Data Handler ist ein WordPress-Plugin kombiniert mit einer C#-Anwendung, die zusammenarbeiten, um Daten sicher zu verwalten und auszutauschen. Das WordPress-Plugin definiert spezifische REST-API-Endpunkte, die es einer C#-Anwendung ermöglichen, Daten zu lesen (GET) und zu schreiben (POST). Diese Daten können für eine Vielzahl von Anwendungen nützlich sein, beispielsweise für das Abrufen und Aktualisieren von Konfigurationseinstellungen, Nutzerdaten oder anderen dynamischen Inhalten, die auf der WordPress-Seite gepflegt werden.</p>
<p><strong>Download Exe &#038; WordPress Plugin (sofort kostenlos nutzbar):</strong><br />
[sdm_download id=&#8221;8231&#8243; fancy=&#8221;0&#8243;]<br />
Shortcode in WordPress für Anzeige der Daten: &#x5B;hnp_win_data_display]</p>
<p><strong>Github:</strong><br />
<a href="https://github.com/HNP-Christopher-Rohde/Hnp-win-data-handler/tree/main" rel="nofollow noopener" target="_blank">https://github.com/HNP-Christopher-Rohde/Hnp-win-data-handler/tree/main</a></p>
<p><strong>C# Source-Code für die Win EXE / Anwendung:</strong><br />
Die C#-Komponente handhabt die Benutzereingaben und interagiert direkt mit der REST-API. Sie bietet Funktionen zum Ändern der Domain-URL, zum Laden von Daten aus WordPress und zum Speichern von Änderungen an den Daten. Diese Flexibilität macht es möglich, die Datenverwaltung von jeder C#-basierten Benutzeroberfläche aus zu steuern.</p>
<pre>
// HNP Win Data Handler v.1.0 EXE
// Author: HNP C.R.
// Author URI: https://homepage-nach-preis.de/
// Licence: Creative Commons Non-Commercial 

using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
using Newtonsoft.Json;

class hnp_win_data_Main
{
    private static readonly HttpClient client = new HttpClient();
    private static string domainFilePath = &#x22;hnp_win_data_domain.txt&#x22;;
    private static string? domainUrl = null;

    private const string SecretKey = &#x22;9418BB768671A389&#x22;;

    static async Task Main(string[] args)
    {
        client.DefaultRequestHeaders.Add(&#x22;X-Secret-Key&#x22;, SecretKey);

        await LoadDomain();
        while (true)
        {
            Console.WriteLine(&#x22;\nMenu:&#x22;);
            Console.WriteLine(&#x22;1. Change Domain&#x22;);
            Console.WriteLine(&#x22;2. Load Data from WordPress&#x22;);
            Console.WriteLine(&#x22;3. Change and Save Data&#x22;);
            Console.Write(&#x22;Select an option: &#x22;);

            string? option = Console.ReadLine();
            switch (option)
            {
                case &#x22;1&#x22;:
                    ChangeDomain();
                    break;
                case &#x22;2&#x22;:
                    await LoadDataFromWordPress();
                    break;
                case &#x22;3&#x22;:
                    await ChangeAndSaveData();
                    break;
                default:
                    Console.WriteLine(&#x22;Invalid option.&#x22;);
                    break;
            }
        }
    }

    static async Task LoadDomain()
    {
        if (File.Exists(domainFilePath))
        {
            domainUrl = await File.ReadAllTextAsync(domainFilePath) ?? string.Empty;
            Console.WriteLine($&#x22;Loaded domain: {domainUrl}&#x22;);
        }
        else
        {
            Console.Write(&#x22;Enter domain URL: &#x22;);
            domainUrl = Console.ReadLine();
            if (!string.IsNullOrWhiteSpace(domainUrl))
            {
                await File.WriteAllTextAsync(domainFilePath, domainUrl);
            }
        }
    }

    static void ChangeDomain()
    {
        Console.Write(&#x22;Enter new domain URL: &#x22;);
        string? newDomainUrl = Console.ReadLine();
        if (!string.IsNullOrWhiteSpace(newDomainUrl))
        {
            domainUrl = newDomainUrl;
            File.WriteAllText(domainFilePath, domainUrl);
            Console.WriteLine(&#x22;Domain updated successfully.&#x22;);
        }
        else
        {
            Console.WriteLine(&#x22;Invalid domain URL provided.&#x22;);
        }
    }

    static async Task LoadDataFromWordPress()
    {
        if (!string.IsNullOrWhiteSpace(domainUrl))
        {
            try
            {
                HttpResponseMessage response = await client.GetAsync(domainUrl + &#x22;/wp-json/hnp-win-data/v1/data&#x22;);
                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                string decodedData = JsonConvert.DeserializeObject&#x3C;string&#x3E;(responseBody) ?? &#x22;Default or empty data&#x22;;
                Console.WriteLine(&#x22;Data loaded: &#x22; + decodedData);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine(&#x22;\nException Caught!&#x22;);
                Console.WriteLine(&#x22;Message :{0} &#x22;, e.Message);
            }
        }
        else
        {
            Console.WriteLine(&#x22;Domain URL is not set. Please set the domain URL first.&#x22;);
        }
    }

    static async Task ChangeAndSaveData()
    {
        Console.Write(&#x22;Enter new data value: &#x22;);
        string? newData = Console.ReadLine();
        if (!string.IsNullOrWhiteSpace(newData) &#x26;&#x26; !string.IsNullOrWhiteSpace(domainUrl))
        {
            var content = new StringContent($&#x22;\&#x22;{newData}\&#x22;&#x22;, System.Text.Encoding.UTF8, &#x22;application/json&#x22;);
            try
            {
                HttpResponseMessage response = await client.PostAsync(domainUrl + &#x22;/wp-json/hnp-win-data/v1/data&#x22;, content);
                response.EnsureSuccessStatusCode();
                Console.WriteLine(&#x22;Data saved successfully.&#x22;);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine(&#x22;\nException Caught!&#x22;);
                Console.WriteLine(&#x22;Message :{0} &#x22;, e.Message);
            }
        }
        else
        {
            Console.WriteLine(&#x22;Invalid data value or domain URL is not set.&#x22;);
        }
    }
}

</pre>
<p><strong>PHP Source Code für das WordPress Plugin:</strong><br />
Das Plugin registriert zwei REST-API-Endpunkte: einen für GET-Anfragen, um Daten abzurufen, und einen für POST-Anfragen, um Daten zu aktualisieren. Jede Anfrage wird über eine Funktion verarbeitet, die den geheimen Schlüssel überprüft, um sicherzustellen, dass nur berechtigte Anfragen bearbeitet werden.</p>
<pre>
&#x3C;?php

 /*
  Plugin Name: HNP Win Data Handler
  Description: Handles data via custom REST API for an external C# application with security enhancements.
  Version: 1.0
  Author: HNP C.R.
  Author URI: https://homepage-nach-preis.de/
  License: GPLv3
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
  Shortcode: hnp_win_data_display
*/

define(&#x27;HNP_WIN_DATA_SECRET_KEY&#x27;, &#x27;9418BB768671A389&#x27;);  // Set your secret key here

// Register REST API routes
add_action(&#x27;rest_api_init&#x27;, function () {
    register_rest_route(&#x27;hnp-win-data/v1&#x27;, &#x27;/data&#x27;, array(
        &#x27;methods&#x27; =&#x3E; &#x27;GET&#x27;,
        &#x27;callback&#x27; =&#x3E; &#x27;hnp_win_data_get_data&#x27;,
        &#x27;permission_callback&#x27; =&#x3E; &#x27;hnp_win_data_check_secret_key&#x27;
    ));
    register_rest_route(&#x27;hnp-win-data/v1&#x27;, &#x27;/data&#x27;, array(
        &#x27;methods&#x27; =&#x3E; &#x27;POST&#x27;,
        &#x27;callback&#x27; =&#x3E; &#x27;hnp_win_data_set_data&#x27;,
        &#x27;permission_callback&#x27; =&#x3E; &#x27;hnp_win_data_check_secret_key&#x27;
    ));
});

// Function to handle GET request
function hnp_win_data_get_data(WP_REST_Request $request) {
    $value = get_option(&#x27;hnp_win_data_value&#x27;, &#x27;No data set.&#x27;);
    return new WP_REST_Response($value, 200);
}

// Function to handle POST request
function hnp_win_data_set_data(WP_REST_Request $request) {
    $data = $request-&#x3E;get_body();
    $clean_data = sanitize_text_field($data);
    update_option(&#x27;hnp_win_data_value&#x27;, $clean_data);
    return new WP_REST_Response(&#x27;Data updated successfully.&#x27;, 200);
}

// Permission check to validate secret key
function hnp_win_data_check_secret_key($request) {
    $headers = $request-&#x3E;get_headers();
    $provided_secret = $headers[&#x27;x_secret_key&#x27;][0] ?? &#x27;&#x27;;
    return $provided_secret === HNP_WIN_DATA_SECRET_KEY;
}

// Shortcode to display the data in the frontend
add_shortcode(&#x27;hnp_win_data_display&#x27;, &#x27;hnp_win_data_display_shortcode&#x27;);
function hnp_win_data_display_shortcode() {
    $value = get_option(&#x27;hnp_win_data_value&#x27;, &#x27;No data set.&#x27;);
    return esc_html($value);
}

</pre>
<p>Der HNP Win Data Handler ist ein Beispiel für die erfolgreiche Integration von Web- und Desktop-Technologien zur Datensynchronisation. Die Kombination aus einem WordPress-Plugin und einer C#-Anwendung bietet eine sichere und flexible Lösung für das Datenmanagement, die in vielen Geschäftsbereichen und Anwendungen nützlich sein kann. Mit seinem modularen Aufbau und der hohen Sicherheit stellt dieses System eine wertvolle Ressource für Entwickler dar, die in gemischten Technologieumgebungen arbeiten.</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/27/hnp-win-data-handler-datenaustausch-zwischen-wordpress-windows/">HNP Win Data Handler – Datenaustausch zwischen WordPress &#038; Windows</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/27/hnp-win-data-handler-datenaustausch-zwischen-wordpress-windows/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WooCommerce Warenkorb Leeren &#038; Session Button</title>
		<link>https://homepage-nach-preis.de/2024/04/15/woocommerce-warenkorb-leeren-session-button/</link>
					<comments>https://homepage-nach-preis.de/2024/04/15/woocommerce-warenkorb-leeren-session-button/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Mon, 15 Apr 2024 14:27:03 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Onlineshop]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Button]]></category>
		<category><![CDATA[leeren]]></category>
		<category><![CDATA[Warenkorb]]></category>
		<category><![CDATA[Woocommerce]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8204</guid>

					<description><![CDATA[<p>Das HNP Warenkorb Leeren Button Plugin für WooCommerce und WordPress erzeugt einen Button auf der Warenkorb-Seite, welcher bei Betätigung den kompletten Warenkorb leert und zudem die Session und Cookies resetet. Download: [sdm_download id=&#8221;8202&#8243; fancy=&#8221;0&#8243;] &#x3C;?php /** Plugin Name: HNP Clear WooCommerce Cart &#x26; Session Description: Ein Plugin zum Leeren des WooCommerce Warenkorbs und L&#xF6;schen von Sessions und Cookies. Version: 1.2 Author: HNP C.R. Author URI: https://homepage-nach-preis.de/ License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html */ // Exit, wenn der Direktzugriff verhindert ist if (!defined(&#x27;ABSPATH&#x27;)) { exit; } function hnp_cwc_enqueue_scripts() { if (is_cart() &#x26;&#x26; get_option(&#x27;hnp_cwc_enable&#x27;, &#x27;no&#x27;) == &#x27;yes&#x27; &#x26;&#x26; get_option(&#x27;hnp_cwc_hook_enable&#x27;, &#x27;no&#x27;) == &#x27;yes&#x27;) { $nonce = wp_create_nonce(&#x27;hnp_cwc_nonce&#x27;); $script = &#x22; var ajaxurl = &#x27;&#x22; . admin_url(&#x27;admin-ajax.php&#x27;) . &#x22;&#x27;; var nonce = &#x27;&#x22; . $nonce . &#x22;&#x27;; document.addEventListener(&#x27;DOMContentLoaded&#x27;, function() { var clearCartButton = document.getElementById(&#x27;clear-cart&#x27;); clearCartButton.addEventListener(&#x27;click&#x27;, function() { // Clear cart var xhr = new XMLHttpRequest(); xhr.open(&#x27;POST&#x27;, ajaxurl, true); xhr.setRequestHeader(&#x27;Content-Type&#x27;, &#x27;application/x-www-form-urlencoded&#x27;); xhr.setRequestHeader(&#x27;X-WP-Nonce&#x27;, nonce); xhr.onload = function() { if (this.status &#x3E;= 200 &#x26;&#x26; this.status &#x3C; 400) { console.log(&#x27;Cart Cleared&#x27;, this.responseText); // Clear sessions and cookies var xhr2 = new XMLHttpRequest(); xhr2.open(&#x27;POST&#x27;, ajaxurl, true); xhr2.setRequestHeader(&#x27;Content-Type&#x27;, &#x27;application/x-www-form-urlencoded&#x27;); xhr2.setRequestHeader(&#x27;X-WP-Nonce&#x27;, nonce); xhr2.onload = function() { if (this.status &#x3E;= 200 &#x26;&#x26; this.status &#x3C; 400) { console.log(&#x27;Sessions and Cookies Cleared&#x27;, this.responseText); // Reload....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/15/woocommerce-warenkorb-leeren-session-button/">WooCommerce Warenkorb Leeren &#038; Session Button</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das HNP Warenkorb Leeren Button Plugin für WooCommerce und WordPress erzeugt einen Button auf der Warenkorb-Seite, welcher bei Betätigung den kompletten Warenkorb leert und zudem die Session und Cookies resetet.</p>
<p><strong>Download: </strong><br />
[sdm_download id=&#8221;8202&#8243; fancy=&#8221;0&#8243;]</p>
<pre>
&#x3C;?php
/**
Plugin Name: HNP Clear WooCommerce Cart &#x26; Session
Description: Ein Plugin zum Leeren des WooCommerce Warenkorbs und L&#xF6;schen von Sessions und Cookies.
Version: 1.2
Author: HNP C.R.
Author URI: https://homepage-nach-preis.de/
License: GPLv3
License URI: https://www.gnu.org/licenses/gpl-3.0.html
 */

// Exit, wenn der Direktzugriff verhindert ist
if (!defined(&#x27;ABSPATH&#x27;)) {
    exit;
}

function hnp_cwc_enqueue_scripts() {
    if (is_cart() &#x26;&#x26; get_option(&#x27;hnp_cwc_enable&#x27;, &#x27;no&#x27;) == &#x27;yes&#x27; &#x26;&#x26; get_option(&#x27;hnp_cwc_hook_enable&#x27;, &#x27;no&#x27;) == &#x27;yes&#x27;) {
        $nonce = wp_create_nonce(&#x27;hnp_cwc_nonce&#x27;);
        
        $script = &#x22;
            var ajaxurl = &#x27;&#x22; . admin_url(&#x27;admin-ajax.php&#x27;) . &#x22;&#x27;;
            var nonce = &#x27;&#x22; . $nonce . &#x22;&#x27;;
            
            document.addEventListener(&#x27;DOMContentLoaded&#x27;, function() {
                var clearCartButton = document.getElementById(&#x27;clear-cart&#x27;);
                
                clearCartButton.addEventListener(&#x27;click&#x27;, function() {
                    // Clear cart
                    var xhr = new XMLHttpRequest();
                    xhr.open(&#x27;POST&#x27;, ajaxurl, true);
                    xhr.setRequestHeader(&#x27;Content-Type&#x27;, &#x27;application/x-www-form-urlencoded&#x27;);
                    xhr.setRequestHeader(&#x27;X-WP-Nonce&#x27;, nonce);
                    xhr.onload = function() {
                        if (this.status &#x3E;= 200 &#x26;&#x26; this.status &#x3C; 400) {
                            console.log(&#x27;Cart Cleared&#x27;, this.responseText);
                            
                            // Clear sessions and cookies
                            var xhr2 = new XMLHttpRequest();
                            xhr2.open(&#x27;POST&#x27;, ajaxurl, true);
                            xhr2.setRequestHeader(&#x27;Content-Type&#x27;, &#x27;application/x-www-form-urlencoded&#x27;);
                            xhr2.setRequestHeader(&#x27;X-WP-Nonce&#x27;, nonce);
                            xhr2.onload = function() {
                                if (this.status &#x3E;= 200 &#x26;&#x26; this.status &#x3C; 400) {
                                    console.log(&#x27;Sessions and Cookies Cleared&#x27;, this.responseText);
                                    
                                    // Reload the page after clearing cart and sessions/cookies
                                    location.reload();
                                } else {
                                    console.error(&#x27;Error clearing sessions and cookies&#x27;, this);
                                }
                            };
                            xhr2.onerror = function() {
                                console.error(&#x27;Error clearing sessions and cookies&#x27;, this);
                            };
                            xhr2.send(&#x27;action=hnp_clear_sessions_cookies&#x26;nonce=&#x27; + nonce);
                            
                        } else {
                            console.error(&#x27;Error clearing cart&#x27;, this);
                        }
                    };
                    xhr.onerror = function() {
                        console.error(&#x27;Error clearing cart&#x27;, this);
                    };
                    xhr.send(&#x27;action=hnp_clear_cart_session&#x26;nonce=&#x27; + nonce);
                });
            });
        &#x22;;
        wp_add_inline_script(&#x27;jquery&#x27;, $script);
    }
}


add_action(&#x27;wp_enqueue_scripts&#x27;, &#x27;hnp_cwc_enqueue_scripts&#x27;);



// Register shortcode
function hnp_cwc_button_shortcode() {
    ob_start(); ?&#x3E;
    &#x3C;button id=&#x22;clear-cart&#x22;&#x3E;Warenkorb leeren&#x3C;/button&#x3E;
    &#x3C;?php
    return ob_get_clean();
}
add_shortcode(&#x27;hnp_cwc_button&#x27;, &#x27;hnp_cwc_button_shortcode&#x27;);

// Hook to display the button on cart page
function hnp_cwc_display_button() {
    if (get_option(&#x27;hnp_cwc_hook_enable&#x27;, &#x27;no&#x27;) == &#x27;yes&#x27;) {
        echo do_shortcode(&#x27;[hnp_cwc_button]&#x27;);
    }
}
add_action(&#x27;woocommerce_cart_actions&#x27;, &#x27;hnp_cwc_display_button&#x27;);

// AJAX handler to clear cart
function hnp_cwc_clear_cart() {
    check_ajax_referer(&#x27;hnp_cwc_nonce&#x27;, &#x27;nonce&#x27;);

    try {
        WC()-&#x3E;cart-&#x3E;empty_cart();
        echo &#x27;Cart Cleared&#x27;;
    } catch (Exception $e) {
        echo &#x27;Error clearing cart: &#x27; . $e-&#x3E;getMessage();
    }
    die();
}

add_action(&#x27;wp_ajax_hnp_clear_cart_session&#x27;, &#x27;hnp_cwc_clear_cart&#x27;);
add_action(&#x27;wp_ajax_nopriv_hnp_clear_cart_session&#x27;, &#x27;hnp_cwc_clear_cart&#x27;);

</pre>
<pre>

// AJAX handler to clear sessions and cookies
function hnp_cwc_clear_sessions_cookies() {
    check_ajax_referer(&#x27;hnp_cwc_nonce&#x27;, &#x27;nonce&#x27;);

    try {
        // Reset WooCommerce session
        WC()-&#x3E;session-&#x3E;set_customer_session_cookie(false);
        WC()-&#x3E;session-&#x3E;set_session_cookie(false);
        WC()-&#x3E;session-&#x3E;reset_session();

        // Unset all cookies
        foreach ($_COOKIE as $cookie_key =&#x3E; $cookie_value) {
            unset($_COOKIE[$cookie_key]);
            setcookie($cookie_key, &#x27;&#x27;, time() - 3600, &#x27;/&#x27;, $_SERVER[&#x27;HTTP_HOST&#x27;]);
            setcookie($cookie_key, &#x27;&#x27;, time() - 3600, &#x27;/&#x27;, &#x27;.&#x27; . $_SERVER[&#x27;HTTP_HOST&#x27;]);
        }

        echo &#x27;Sessions and Cookies Cleared&#x27;;
    } catch (Exception $e) {
        echo &#x27;Error clearing sessions and cookies: &#x27; . $e-&#x3E;getMessage();
    }
    die();
}


add_action(&#x27;wp_ajax_hnp_clear_sessions_cookies&#x27;, &#x27;hnp_cwc_clear_sessions_cookies&#x27;);
add_action(&#x27;wp_ajax_nopriv_hnp_clear_sessions_cookies&#x27;, &#x27;hnp_cwc_clear_sessions_cookies&#x27;);


// Admin settings
function hnp_cwc_admin_menu() {
    add_menu_page(
        &#x27;HNP Clear WooCommerce Cart Settings&#x27;, 
        &#x27;HNP Clear WooCommerce Cart&#x27;,           
        &#x27;manage_options&#x27;,                   
        &#x27;hnp_cwc_settings&#x27;,                 
        &#x27;hnp_cwc_settings_page&#x27;,            
&#x9;&#x9; plugin_dir_url(__FILE__) . &#x27;img/hnp-favi.png&#x27;                               
    );
}
add_action(&#x27;admin_menu&#x27;, &#x27;hnp_cwc_admin_menu&#x27;);

function hnp_cwc_settings_page() {
&#x9;if (!current_user_can(&#x27;manage_options&#x27;)) {
        return;
    }
    if ($_SERVER[&#x27;REQUEST_METHOD&#x27;] === &#x27;POST&#x27; &#x26;&#x26; check_admin_referer(&#x27;hnp_cwc_nonce&#x27;, &#x27;hnp_cwc_nonce_field&#x27;)) {
        if (isset($_POST[&#x27;hnp_cwc_enable&#x27;])) {
            update_option(&#x27;hnp_cwc_enable&#x27;, $_POST[&#x27;hnp_cwc_enable&#x27;]);
        } else {
            update_option(&#x27;hnp_cwc_enable&#x27;, &#x27;no&#x27;);
        }

        if (isset($_POST[&#x27;hnp_cwc_hook_enable&#x27;])) {
            update_option(&#x27;hnp_cwc_hook_enable&#x27;, $_POST[&#x27;hnp_cwc_hook_enable&#x27;]);
        } else {
            update_option(&#x27;hnp_cwc_hook_enable&#x27;, &#x27;no&#x27;);
        }
    }

    $enabled = get_option(&#x27;hnp_cwc_enable&#x27;, &#x27;no&#x27;);
    $hook_enabled = get_option(&#x27;hnp_cwc_hook_enable&#x27;, &#x27;no&#x27;);
    $nonce = wp_create_nonce(&#x27;hnp_cwc_nonce&#x27;);
    ?&#x3E;
    &#x3C;div class=&#x22;wrap&#x22;&#x3E;
        &#x3C;h2&#x3E;HNP Clear WooCommerce Cart Settings&#x3C;/h2&#x3E;
        &#x3C;form method=&#x22;post&#x22; action=&#x22;&#x22;&#x3E;
            &#x3C;?php wp_nonce_field(&#x27;hnp_cwc_nonce&#x27;, &#x27;hnp_cwc_nonce_field&#x27;); ?&#x3E;
            &#x3C;table class=&#x22;form-table&#x22;&#x3E;
                &#x3C;tr&#x3E;
                    &#x3C;th scope=&#x22;row&#x22;&#x3E;Allgemeine Funktion aktivieren&#x3C;/th&#x3E;
                    &#x3C;td&#x3E;
                        &#x3C;input type=&#x22;checkbox&#x22; name=&#x22;hnp_cwc_enable&#x22; value=&#x22;yes&#x22; &#x3C;?php checked(&#x27;yes&#x27;, $enabled); ?&#x3E; /&#x3E;
                    &#x3C;/td&#x3E;
                &#x3C;/tr&#x3E;
                &#x3C;tr&#x3E;
                    &#x3C;th scope=&#x22;row&#x22;&#x3E;Hook f&#xFC;r Warenkorb aktivieren&#x3C;/th&#x3E;
                    &#x3C;td&#x3E;
                        &#x3C;input type=&#x22;checkbox&#x22; name=&#x22;hnp_cwc_hook_enable&#x22; value=&#x22;yes&#x22; &#x3C;?php checked(&#x27;yes&#x27;, $hook_enabled); ?&#x3E; /&#x3E;
                    &#x3C;/td&#x3E;
                &#x3C;/tr&#x3E;
&#x9;&#x9;&#x9;&#x9;&#x3C;tr&#x3E;Shortcode um den Button manuell einzubinden: [hnp_cwc_button]&#x3C;/tr&#x3E;
            &#x3C;/table&#x3E;
            &#x3C;?php submit_button(); ?&#x3E;
        &#x3C;/form&#x3E;
    &#x3C;/div&#x3E;
    &#x3C;?php
}

</pre>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/15/woocommerce-warenkorb-leeren-session-button/">WooCommerce Warenkorb Leeren &#038; Session Button</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/15/woocommerce-warenkorb-leeren-session-button/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HNP Empty Plugin &#8211; WordPress Demo Code</title>
		<link>https://homepage-nach-preis.de/2024/04/10/hnp-empty-plugin-wordpress-demo-code/</link>
					<comments>https://homepage-nach-preis.de/2024/04/10/hnp-empty-plugin-wordpress-demo-code/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Wed, 10 Apr 2024 13:54:30 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Beispiel]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Demo]]></category>
		<category><![CDATA[Empty]]></category>
		<category><![CDATA[Leeres]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8186</guid>

					<description><![CDATA[<p>Das HNP Empty Plugin ist ein einfaches Demo-Plugin für WordPress, das entwickelt wurde, um grundlegende Funktionen eines Plugins zu demonstrieren. Es zeigt, wie man Styles und Skripte sowohl im Frontend als auch im Backend von WordPress einbindet. Außerdem bietet es eine Benutzeroberfläche zur Verwaltung von Plugin-Optionen über das WordPress-Dashboard. Der Plugin-Demo Code besitzt alle wichtigen Sicherheitsoptionen und Code-Qualitätsanforderungen, damit ein Plugin im offiziellen WordPress Verzeichnis aufgenommen wird. Zudem Funktionen, welche im Jahr 2024 auf dem neuesten Stand sind. Somit eine gute Grundlage für WordPress-Plugin-Entwickler. Geteste Kompatibilität: WordPress 6.5.2 und PHP 8.3. Das Plugin wird aber auch mit neueren und älteren PHP und WordPress Versionen kompatibel sein. Features: Frontend und Backend Styling: Das Plugin fügt sowohl dem Frontend als auch dem Backend von WordPress benutzerdefinierte CSS- und JavaScript-Dateien hinzu, um das Erscheinungsbild anzupassen. Plugin-Optionen: Es bietet eine einfache Möglichkeit, Plugin-Optionen über das WordPress-Dashboard zu konfigurieren, einschließlich Textfelder, Zahlenfelder, Farbwähler, Dropdown-Listen und Checkboxen. Shortcode: Das Plugin stellt einen Shortcode bereit, mit dem Benutzer die konfigurierten Optionen auf beliebigen Seiten oder Beiträgen anzeigen können. Sicherheitsmaßnahmen: Das Plugin implementiert Sicherheitsmaßnahmen wie Nonce-Überprüfung, um unerwünschte Zugriffe auf die Plugin-Einstellungen zu verhindern. &#160; Plugin-Download: [sdm_download id=&#8221;8187&#8243; fancy=&#8221;0&#8243;] Github: https://github.com/HNP-Christopher-Rohde/hnp_empty_wordpress_plugin Quellcode: &#60;?php /* Plugin Name: HNP Empty....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/10/hnp-empty-plugin-wordpress-demo-code/">HNP Empty Plugin &#8211; WordPress Demo Code</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das HNP Empty Plugin ist ein einfaches Demo-Plugin für WordPress, das entwickelt wurde, um grundlegende Funktionen eines Plugins zu demonstrieren. Es zeigt, wie man Styles und Skripte sowohl im Frontend als auch im Backend von WordPress einbindet. Außerdem bietet es eine Benutzeroberfläche zur Verwaltung von Plugin-Optionen über das WordPress-Dashboard. Der Plugin-Demo Code besitzt alle wichtigen Sicherheitsoptionen und Code-Qualitätsanforderungen, damit ein Plugin im offiziellen WordPress Verzeichnis aufgenommen wird. Zudem Funktionen, welche im Jahr 2024 auf dem neuesten Stand sind. Somit eine gute Grundlage für WordPress-Plugin-Entwickler. Geteste Kompatibilität: WordPress 6.5.2 und PHP 8.3. Das Plugin wird aber auch mit neueren und älteren PHP und WordPress Versionen kompatibel sein. </p>
<p><strong>Features:</strong></p>
<ul>
<li><strong>Frontend und Backend Styling:</strong> Das Plugin fügt sowohl dem Frontend als auch dem Backend von WordPress benutzerdefinierte CSS- und JavaScript-Dateien hinzu, um das Erscheinungsbild anzupassen.</li>
<li><strong>Plugin-Optionen:</strong> Es bietet eine einfache Möglichkeit, Plugin-Optionen über das WordPress-Dashboard zu konfigurieren, einschließlich Textfelder, Zahlenfelder, Farbwähler, Dropdown-Listen und Checkboxen.</li>
<li><strong>Shortcode:</strong> Das Plugin stellt einen Shortcode bereit, mit dem Benutzer die konfigurierten Optionen auf beliebigen Seiten oder Beiträgen anzeigen können.</li>
<li><strong>Sicherheitsmaßnahmen:</strong> Das Plugin implementiert Sicherheitsmaßnahmen wie Nonce-Überprüfung, um unerwünschte Zugriffe auf die Plugin-Einstellungen zu verhindern.</li>
</ul>
<p>&nbsp;</p>
<p><strong>Plugin-Download:</strong> [sdm_download id=&#8221;8187&#8243; fancy=&#8221;0&#8243;]<br />
<strong>Github:</strong> <a href="https://github.com/HNP-Christopher-Rohde/hnp_empty_wordpress_plugin" target="_blank" rel="nofollow noopener">https://github.com/HNP-Christopher-Rohde/hnp_empty_wordpress_plugin</a><br />
<strong>Quellcode:</strong></p>
<pre>&lt;?php
/*
  Plugin Name: HNP Empty Plugin
  Description: Creates a Demo Plugin in WordPress
  Version: 2.0
  Author: HNP C.R. 
  Author URI: https://homepage-nach-preis.de/
  License: GPLv3
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
 */

// Security check to prevent direct access to the plugin file
defined('ABSPATH') or die('No script kiddies please!');

// Function to enqueue the Frontend CSS and JS
function hnp_empty_plugin_frontend_scripts() {
    // Define a version number
    $version = '2.0';

    // Check if CSS is not already enqueued
    if (!wp_style_is('hnp_empty_plugin_frontend-css')) {
        // Enqueue CSS with the defined version
        wp_enqueue_style('hnp_empty_plugin_frontend-css', plugin_dir_url(__FILE__) . '/frontend/css/hnp_empty_plugin_frontend.css', array(), $version);
    }

    // Check if JavaScript is not already enqueued
    if (!wp_script_is('hnp_empty_plugin_frontend-js')) {
        // Enqueue JavaScript with the defined version
        wp_enqueue_script('hnp_empty_plugin_frontend-js', plugin_dir_url(__FILE__) . '/frontend/js/hnp_empty_plugin_frontend.js', array(), $version, true);
    }
}
add_action('wp_enqueue_scripts', 'hnp_empty_plugin_frontend_scripts');

// Function to enqueue Backend CSS and JS
function hnp_empty_plugin_backend_scripts() {
    // Define a version number
    $version = '2.0';

    // Check if CSS is not already enqueued
    if (!wp_style_is('hnp_empty_plugin_backend-css')) {
        // Enqueue CSS with the defined version
        wp_enqueue_style('hnp_empty_plugin_backend-css', plugin_dir_url(__FILE__) . '/backend/css/hnp_empty_plugin_backend.css', array(), $version);
    }

    // Check if JavaScript is not already enqueued
    if (!wp_script_is('hnp_empty_plugin_backend-js')) {
        // Enqueue JavaScript with the defined version
        wp_enqueue_script('hnp_empty_plugin_backend-js', plugin_dir_url(__FILE__) . '/backend/js/hnp_empty_plugin_backend.js', array(), $version, true);
    }
}
add_action('admin_enqueue_scripts', 'hnp_empty_plugin_backend_scripts');

// Function for Test - with load Options and Fallback
function hnp_empty_plugin_echo_func() {
    // Get option values
    $name = get_option('hnp_empty_plugin_name_field', 'Name');
    $number = get_option('hnp_empty_plugin_number_field', '12');
    $color = get_option('hnp_empty_plugin_color_field', '#ff0000');
    $description = get_option('hnp_empty_plugin_description_field', 'Im a Desc Field');
    $dropdown = get_option('hnp_empty_plugin_dropdown_field', 'option1');
    $checkbox = get_option('hnp_empty_plugin_checkbox_field', 0);

    // Echo option values
    echo '&lt;p&gt;Name Field: ' . esc_html($name) . '&lt;/p&gt;';
    echo '&lt;p&gt;Number Field: ' . esc_html($number) . '&lt;/p&gt;';
    echo '&lt;p&gt;Color Field: ' . esc_html($color) . '&lt;/p&gt;';
    echo '&lt;p&gt;Description Field: ' . esc_html($description) . '&lt;/p&gt;';
    echo '&lt;p&gt;Dropdown Field: ' . esc_html($dropdown) . '&lt;/p&gt;';
    echo '&lt;p&gt;Checkbox Field: ' . ($checkbox ? 'Enabled' : 'Disabled') . '&lt;/p&gt;';
}
add_shortcode('hnp_empty_plugin_echo_func', 'hnp_empty_plugin_echo_func');


// Function to add plugin options to the main menu
function hnp_empty_plugin_add_plugin_options_page() {
    // Check permission
    if (current_user_can('manage_options')) {
        add_menu_page(
            'HNP Empty Plugin Settings',
            'HNP Empty Plugin',
            'manage_options',
            'hnp-empty-plugin-settings',
            'hnp_empty_plugin_render_plugin_options_page',
            plugin_dir_url(__FILE__) . 'img/hnp-favi.png' 
        );
    }
}
add_action('admin_menu', 'hnp_empty_plugin_add_plugin_options_page');


// Function to render plugin options page
function hnp_empty_plugin_render_plugin_options_page() {
    ?&gt;
    &lt;div class="wrap hnp-empty-plugin-settings"&gt;
        &lt;h1&gt;HNP Empty Plugin Settings&lt;/h1&gt;
        &lt;form method="post" action="options.php"&gt;
            &lt;?php settings_fields('hnp_empty_plugin_settings_group'); ?&gt;
            &lt;?php do_settings_sections('hnp-empty-plugin-settings'); ?&gt;
            
            &lt;?php 
                // Add nonce
                wp_nonce_field('hnp_empty_plugin_settings_nonce', 'hnp_empty_plugin_settings_nonce'); 
            ?&gt;
            
            &lt;?php submit_button(); ?&gt;
        &lt;/form&gt;
    &lt;/div&gt;
    &lt;?php
}

// Function to register plugin options
function hnp_empty_plugin_register_plugin_options() {
    // Name
    add_settings_section(
        'hnp_empty_plugin_name_section',
        'Demo',
        'hnp_empty_plugin_demo_section_callback',
        'hnp-empty-plugin-settings'
    );

    // Name
    add_settings_field(
        'hnp_empty_plugin_name_field', 
        'Name Field', 
        'hnp_empty_plugin_name_field_callback', 
        'hnp-empty-plugin-settings', 
        'hnp_empty_plugin_name_section' 
    );

    // Number
    add_settings_field(
        'hnp_empty_plugin_number_field',
        'Number Field',
        'hnp_empty_plugin_number_field_callback',
        'hnp-empty-plugin-settings',
        'hnp_empty_plugin_name_section'
    );

    // Color
    add_settings_field(
        'hnp_empty_plugin_color_field',
        'Color Field',
        'hnp_empty_plugin_color_field_callback',
        'hnp-empty-plugin-settings',
        'hnp_empty_plugin_name_section'
    );

    // Description
    add_settings_field(
        'hnp_empty_plugin_description_field',
        'Description Field',
        'hnp_empty_plugin_description_field_callback',
        'hnp-empty-plugin-settings',
        'hnp_empty_plugin_name_section'
    );

    // Dropdown
    add_settings_field(
        'hnp_empty_plugin_dropdown_field',
        'Dropdown Field',
        'hnp_empty_plugin_dropdown_field_callback',
        'hnp-empty-plugin-settings',
        'hnp_empty_plugin_name_section'
    );

    // Checkbox
    add_settings_field(
        'hnp_empty_plugin_checkbox_field',
        'Checkbox Field',
        'hnp_empty_plugin_checkbox_field_callback',
        'hnp-empty-plugin-settings',
        'hnp_empty_plugin_name_section'
    );
}
add_action('admin_init', 'hnp_empty_plugin_register_plugin_options');
</pre>
<pre>
// Callback function for demo section
function hnp_empty_plugin_demo_section_callback() {
    echo 'This a Demo Plugin. Frontend-Shortcode: &amp;#x5B;hnp_empty_plugin_echo_func]&lt;/p&gt;';
}

// Callback function for name field
function hnp_empty_plugin_name_field_callback() {
    $value = get_option('hnp_empty_plugin_name_field', 'Name'); // Fallback value is 'Name'
    echo '&lt;input type="text" name="hnp_empty_plugin_name_field" value="' . esc_attr($value) . '" /&gt;';
}

// Callback functions for number fields
function hnp_empty_plugin_number_field_callback() {
    $value = get_option('hnp_empty_plugin_number_field', '12'); // Fallback value is '12'
    echo '&lt;input type="number" name="hnp_empty_plugin_number_field" value="' . esc_attr($value) . '" /&gt;';
}

// Callback function for Color Field
function hnp_empty_plugin_color_field_callback() {
    $value = get_option('hnp_empty_plugin_color_field', '#ff0000'); // Fallback value is red color
    echo '&lt;input type="color" name="hnp_empty_plugin_color_field" value="' . esc_attr($value) . '" /&gt;';
}

// Callback function for Description Field
function hnp_empty_plugin_description_field_callback() {
    $value = get_option('hnp_empty_plugin_description_field', 'Im a Desc Field'); // Fallback value is 'Im a Desc Field'
    echo '&lt;textarea name="hnp_empty_plugin_description_field"&gt;' . esc_html($value) . '&lt;/textarea&gt;';
}

// Callback function for dropdown field
function hnp_empty_plugin_dropdown_field_callback() {
    $value = get_option('hnp_empty_plugin_dropdown_field', 'option1'); // Fallback value is 'option1'
    ?&gt;
    &lt;select name="hnp_empty_plugin_dropdown_field"&gt;
        &lt;option value="option1" &lt;?php selected($value, 'option1'); ?&gt;&gt;Option 1&lt;/option&gt;
        &lt;option value="option2" &lt;?php selected($value, 'option2'); ?&gt;&gt;Option 2&lt;/option&gt;
        &lt;option value="option3" &lt;?php selected($value, 'option3'); ?&gt;&gt;Option 3&lt;/option&gt;
    &lt;/select&gt;
    &lt;?php
}

// Callback function for checkbox field
function hnp_empty_plugin_checkbox_field_callback() {
    $value = get_option('hnp_empty_plugin_checkbox_field', 0); // Fallback value is 0 (not checked)
    ?&gt;
    &lt;label for="hnp_empty_plugin_checkbox_field"&gt;
        &lt;input type="checkbox" name="hnp_empty_plugin_checkbox_field" id="hnp_empty_plugin_checkbox_field" value="1" &lt;?php checked($value, 1); ?&gt;&gt;
        Enable Checkbox
    &lt;/label&gt;
    &lt;?php
}

// Security measures: Nonce verification and save options
function hnp_empty_plugin_register_security_options() {
    // Check if the current page is our plugin options page
    if (isset($_POST['option_page']) &amp;&amp; $_POST['option_page'] == 'hnp_empty_plugin_settings_group') {
        // Check if the nonce is set and valid
        if (!isset($_POST['hnp_empty_plugin_settings_nonce']) || !wp_verify_nonce($_POST['hnp_empty_plugin_settings_nonce'], 'hnp_empty_plugin_settings_nonce')) {
            // Unauthorized request, do not save options
            wp_die('Unauthorized request.'); // Output error message for unauthorized requests
        }

        // Save options
        update_option('hnp_empty_plugin_name_field', $_POST['hnp_empty_plugin_name_field']);
        update_option('hnp_empty_plugin_number_field', sanitize_text_field($_POST['hnp_empty_plugin_number_field']));
        update_option('hnp_empty_plugin_color_field', sanitize_text_field($_POST['hnp_empty_plugin_color_field']));
        update_option('hnp_empty_plugin_description_field', sanitize_textarea_field($_POST['hnp_empty_plugin_description_field']));
        update_option('hnp_empty_plugin_dropdown_field', sanitize_text_field($_POST['hnp_empty_plugin_dropdown_field']));
        update_option('hnp_empty_plugin_checkbox_field', isset($_POST['hnp_empty_plugin_checkbox_field']) ? 1 : 0);
    }
}
add_action('admin_init', 'hnp_empty_plugin_register_security_options');

// Register plugin options and security measures
function hnp_empty_plugin_register_settings() {
    // Register setting and sanitize callback
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_name_field');
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_number_field');
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_color_field');
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_description_field');
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_dropdown_field');
    register_setting('hnp_empty_plugin_settings_group', 'hnp_empty_plugin_checkbox_field');
}
add_action('admin_init', 'hnp_empty_plugin_register_settings');


// Security measures: Nonce verification for options update
function hnp_empty_plugin_validate_settings($input) {
    return $input; // Simply return the input, no further validation here
}

</pre>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/10/hnp-empty-plugin-wordpress-demo-code/">HNP Empty Plugin &#8211; WordPress Demo Code</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/10/hnp-empty-plugin-wordpress-demo-code/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HNP OpenStreetMap kostenloses Plugin</title>
		<link>https://homepage-nach-preis.de/2024/04/10/hnp-openstreetmap-kostenloses-plugin/</link>
					<comments>https://homepage-nach-preis.de/2024/04/10/hnp-openstreetmap-kostenloses-plugin/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Wed, 10 Apr 2024 10:19:20 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Karte]]></category>
		<category><![CDATA[kostenlos]]></category>
		<category><![CDATA[Openmaps]]></category>
		<category><![CDATA[OpenStreetMap]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Shortcode]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8176</guid>

					<description><![CDATA[<p>Das &#8220;HNP OpenStreetMap Shortcode&#8221; Plugin ermöglicht es Benutzern, OpenStreetMap-Karten mit einem Pin direkt auf ihrer WordPress-Website einzubetten, indem sie einen Shortcode verwenden. Es bietet eine einfache Möglichkeit, einen Standort auf einer interaktiven Karte zu markieren. &#160; Hier sind die Hauptmerkmale des Plugins: Shortcode-Unterstützung: Benutzer können den bereitgestellten Shortcode verwenden, um eine Karte mit einem Pin an einem bestimmten Standort anzuzeigen. Anpassbare Optionen: Das Plugin bietet verschiedene anpassbare Optionen, darunter die Möglichkeit, die Adresse des Pins, den Namen des Markers, den Zoomlevel der Karte, den Kartenstil sowie die Höhe und Breite der Karte anzupassen. Integrierte Sicherheitsmaßnahmen: Das Plugin enthält Sicherheitsmaßnahmen wie Nonce-Überprüfung, um unautorisierte Zugriffe auf die Plugin-Optionen zu verhindern und die Datenintegrität zu gewährleisten. Einfache Konfiguration: Benutzer können die Plugin-Optionen über das WordPress-Adminpanel konfigurieren, um ihre Karten entsprechend ihren Anforderungen anzupassen. Das Plugin wurde von Homepage-nach-Preis.de entwickelt und steht unter der GNU General Public License Version 3 (GPLv3), was bedeutet, dass es kostenlos verwendet und modifiziert werden kann, solange die Lizenzbedingungen eingehalten werden. Download: [sdm_download id=&#8221;8174&#8243; fancy=&#8221;0&#8243;] Github: https://github.com/HNP-Christopher-Rohde/hnp-openstreetmap-wordpress-plugin/tree/main/hnp_openstreetmap Quellcode: &#x3C;?php /* Plugin Name: HNP OpenStreetMap Shortcode Description: Creates a frontend OpenStreetMap map with a pin using a shortcode Version: 1.0 Author: HNP - C.R. Author URI: https://homepage-nach-preis.de/ License: GPLv3....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/10/hnp-openstreetmap-kostenloses-plugin/">HNP OpenStreetMap kostenloses Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das &#8220;HNP OpenStreetMap Shortcode&#8221; Plugin ermöglicht es Benutzern, OpenStreetMap-Karten mit einem Pin direkt auf ihrer WordPress-Website einzubetten, indem sie einen Shortcode verwenden. Es bietet eine einfache Möglichkeit, einen Standort auf einer interaktiven Karte zu markieren.</p>
<p>&nbsp;</p>
<p>Hier sind die Hauptmerkmale des Plugins:</p>
<ol>
<li><strong>Shortcode-Unterstützung:</strong> Benutzer können den bereitgestellten Shortcode verwenden, um eine Karte mit einem Pin an einem bestimmten Standort anzuzeigen.</li>
<li><strong>Anpassbare Optionen:</strong> Das Plugin bietet verschiedene anpassbare Optionen, darunter die Möglichkeit, die Adresse des Pins, den Namen des Markers, den Zoomlevel der Karte, den Kartenstil sowie die Höhe und Breite der Karte anzupassen.</li>
<li><strong>Integrierte Sicherheitsmaßnahmen:</strong> Das Plugin enthält Sicherheitsmaßnahmen wie Nonce-Überprüfung, um unautorisierte Zugriffe auf die Plugin-Optionen zu verhindern und die Datenintegrität zu gewährleisten.</li>
<li><strong>Einfache Konfiguration:</strong> Benutzer können die Plugin-Optionen über das WordPress-Adminpanel konfigurieren, um ihre Karten entsprechend ihren Anforderungen anzupassen.</li>
</ol>
<p>Das Plugin wurde von Homepage-nach-Preis.de entwickelt und steht unter der GNU General Public License Version 3 (GPLv3), was bedeutet, dass es kostenlos verwendet und modifiziert werden kann, solange die Lizenzbedingungen eingehalten werden.</p>
<p><strong>Download:</strong> [sdm_download id=&#8221;8174&#8243; fancy=&#8221;0&#8243;]</p>
<p><strong>Github:</strong> <a href="https://github.com/HNP-Christopher-Rohde/hnp-openstreetmap-wordpress-plugin/tree/main/hnp_openstreetmap" target="_blank" rel="nofollow noopener">https://github.com/HNP-Christopher-Rohde/hnp-openstreetmap-wordpress-plugin/tree/main/hnp_openstreetmap</a><br />
<strong>Quellcode:</strong></p>
<pre>
&#x3C;?php
/*
  Plugin Name: HNP OpenStreetMap Shortcode
  Description: Creates a frontend OpenStreetMap map with a pin using a shortcode
  Version: 1.0
  Author: HNP - C.R.
  Author URI: https://homepage-nach-preis.de/
  License: GPLv3
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
 */

// Security check to prevent direct access to the plugin file
defined(&#x27;ABSPATH&#x27;) or die(&#x27;No script kiddies please!&#x27;);

// Function to enqueue Leaflet library
function hnp_openmaps_enqueue_leaflet_scripts() {
    // Define a version number for your CSS file
    $version = &#x27;1.9.4&#x27;;

    // Check if Leaflet CSS is not already enqueued
    if (!wp_style_is(&#x27;leaflet-css&#x27;)) {
        // Enqueue Leaflet CSS with the defined version
        wp_enqueue_style(&#x27;leaflet-css&#x27;, plugin_dir_url(__FILE__) . &#x27;leaflet/leaflet.css&#x27;, array(), $version);
    }

    // Check if Leaflet JavaScript is not already enqueued
    if (!wp_script_is(&#x27;leaflet-js&#x27;)) {
        // Enqueue Leaflet JavaScript with the defined version
        wp_enqueue_script(&#x27;leaflet-js&#x27;, plugin_dir_url(__FILE__) . &#x27;leaflet/leaflet.js&#x27;, array(), $version, true);
    }
}
add_action(&#x27;wp_enqueue_scripts&#x27;, &#x27;hnp_openmaps_enqueue_leaflet_scripts&#x27;);

// Function to display OpenStreetMap maps with a pin
function hnp_openmaps_display_map_with_pin() {
    // Load options and sanitize address
    $raw_address = get_option(&#x27;hnp_openmaps_map_address&#x27;, &#x27;Hardenbergpl. 8, 10787 Berlin, Germany&#x27;);
    $clean_address = sanitize_text_field($raw_address);

    // Load options and sanitize marker name
    $marker_name = get_option(&#x27;hnp_openmaps_map_name&#x27;, &#x27;Berlin Zoological Garden&#x27;); 

    // Load zoom level, map style, height, and width of the map
    $zoom = get_option(&#x27;hnp_openmaps_map_zoom&#x27;, 12);
    $style = get_option(&#x27;hnp_openmaps_map_style&#x27;, &#x27;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&#x27;);
    $height = get_option(&#x27;hnp_openmaps_map_height&#x27;, &#x27;400px&#x27;);
    $width = get_option(&#x27;hnp_openmaps_map_width&#x27;, &#x27;100%&#x27;);

    // JavaScript variable for map initialization and adding markers
    $map = &#x22;
        &#x3C;script&#x3E;
            document.addEventListener(&#x27;DOMContentLoaded&#x27;, function() {
    &#x22;;

    // Split address into individual parts and encode
    $address_parts = explode(&#x27;,&#x27;, $clean_address);
    $encoded_address_parts = array_map(&#x27;urlencode&#x27;, $address_parts);
    $encoded_address = implode(&#x27;,&#x27;, $encoded_address_parts);

    // Construct Nominatim URL
    $nominatim_url = &#x22;https://nominatim.openstreetmap.org/search?format=json&#x26;q={$encoded_address}&#x22;;

    // Get geocoding data from Nominatim
    $response = wp_remote_get($nominatim_url);

    // Check if the request was successful
    if (!is_wp_error($response) &#x26;&#x26; wp_remote_retrieve_response_code($response) === 200) {
        $data = json_decode(wp_remote_retrieve_body($response), true);

        // Check if geocoding results were obtained
        if (!empty($data)) {
            $latitude = $data[0][&#x27;lat&#x27;];
            $longitude = $data[0][&#x27;lon&#x27;];

            // Initialize map with center at marker coordinates
            $map .= &#x22;
                var hnp_openmaps_map = L.map(&#x27;hnp_openmaps_map&#x27;).setView([$latitude, $longitude], $zoom);
            &#x22;;

            // Add tiles to the map
            $map .= &#x22;
                L.tileLayer(&#x27;$style&#x27;, {
                    attribution: &#x27;&#x26;copy; &#x3C;a href=\&#x22;https://www.openstreetmap.org/copyright\&#x22;&#x3E;OpenStreetMap&#x3C;/a&#x3E; contributors&#x27;
                }).addTo(hnp_openmaps_map);
            &#x22;;

            // Add marker to the map
            $map .= &#x22;
                L.marker([$latitude, $longitude]).addTo(hnp_openmaps_map).bindPopup(&#x27;&#x22; . esc_js($clean_address) . &#x22;&#x27;).bindTooltip(&#x27;&#x22; . esc_js($marker_name) . &#x22;&#x27;);
                console.log(&#x27;Geocoding successful for address:&#x27;, &#x22; . wp_json_encode($clean_address) . &#x22;);
            &#x22;;
        } else {
            // Error retrieving geocoding data
            error_log(&#x22;Error retrieving geocoding data for address: $clean_address&#x22;);
            $map .= &#x22;
                console.log(&#x27;Error retrieving geocoding data for address:&#x27;, &#x22; . wp_json_encode($clean_address) . &#x22;);
            &#x22;;
        }
    } else {
        // Error retrieving geocoding data
        error_log(&#x22;Error retrieving geocoding data for address: $clean_address&#x22;);
        $map .= &#x22;
            console.log(&#x27;Error retrieving geocoding data for address:&#x27;, &#x22; . wp_json_encode($clean_address) . &#x22;);
        &#x22;;
    }

    // Add JavaScript end
    $map .= &#x22;
            });
        &#x3C;/script&#x3E;
    &#x22;;

    // Return map div and JavaScript
    return &#x27;&#x3C;div id=&#x22;hnp_openmaps_map&#x22; style=&#x22;height: &#x27; . esc_attr($height) . &#x27;; width: &#x27; . esc_attr($width) . &#x27;;&#x22;&#x3E;&#x3C;/div&#x3E;&#x27; . $map;
}

// Register shortcode
add_shortcode(&#x27;hnp_openmaps_display_map_with_pin&#x27;, &#x27;hnp_openmaps_display_map_with_pin&#x27;);

// Function to add plugin options to the main menu
function hnp_openmaps_add_plugin_options_page() {
    // Check permission
    if (current_user_can(&#x27;manage_options&#x27;)) {
        add_menu_page(
            &#x27;HNP OpenStreetMap Settings&#x27;,
            &#x27;HNP OpenStreetMap&#x27;,
            &#x27;manage_options&#x27;,
            &#x27;hnp-openmaps-osm-settings&#x27;,
            &#x27;hnp_openmaps_render_plugin_options_page&#x27;,
            plugin_dir_url(__FILE__) . &#x27;img/hnp-favi.png&#x27; 
        );
    }
}
add_action(&#x27;admin_menu&#x27;, &#x27;hnp_openmaps_add_plugin_options_page&#x27;);

// Add settings link to plugin on the Plugins page
function hnp_openmaps_add_settings_link($links) {
    $settings_link = &#x27;&#x3C;a href=&#x22;admin.php?page=hnp-openmaps-osm-settings&#x22;&#x3E;&#x27; . __(&#x27;Settings&#x27;) . &#x27;&#x3C;/a&#x3E;&#x27;;
    array_unshift($links, $settings_link); // Add the settings link at the beginning of the array
    return $links;
}
add_filter(&#x27;plugin_action_links_&#x27; . plugin_basename(__FILE__), &#x27;hnp_openmaps_add_settings_link&#x27;);


// Function to render plugin options page
function hnp_openmaps_render_plugin_options_page() {
    ?&#x3E;
    &#x3C;div class=&#x22;wrap&#x22;&#x3E;
        &#x3C;h1&#x3E;HNP OpenStreetMap Settings&#x3C;/h1&#x3E;
        &#x3C;form method=&#x22;post&#x22; action=&#x22;options.php&#x22;&#x3E;
            &#x3C;?php settings_fields(&#x27;hnp_openmaps_osm_settings_group&#x27;); ?&#x3E;
            &#x3C;?php do_settings_sections(&#x27;hnp-openmaps-osm-settings&#x27;); ?&#x3E;
            &#x3C;?php 
                // Add nonce
                wp_nonce_field(&#x27;hnp_openmaps_osm_settings_nonce&#x27;, &#x27;hnp_openmaps_osm_settings_nonce&#x27;); 
            ?&#x3E;
            &#x3C;?php submit_button(); ?&#x3E;
        &#x3C;/form&#x3E;
    &#x3C;/div&#x3E;
    &#x3C;?php
}

</pre>
<pre>

// Function to register plugin options
function hnp_openmaps_register_plugin_options() {
    // Adresse
    add_settings_section(
        &#x27;hnp_openmaps_osm_address_section&#x27;,
        &#x27;Address&#x27;,
        &#x27;hnp_openmaps_osm_address_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_address&#x27;,
        &#x27;Address&#x27;,
        &#x27;hnp_openmaps_map_address_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_address_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_address&#x27;);

    // Name
    add_settings_section(
        &#x27;hnp_openmaps_osm_name_section&#x27;,
        &#x27;Name&#x27;,
        &#x27;hnp_openmaps_osm_name_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_name&#x27;,
        &#x27;Name&#x27;,
        &#x27;hnp_openmaps_map_name_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_name_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_name&#x27;);

    // Karten-Zoom
    add_settings_section(
        &#x27;hnp_openmaps_osm_zoom_section&#x27;,
        &#x27;Map Zoom&#x27;,
        &#x27;hnp_openmaps_osm_zoom_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_zoom&#x27;,
        &#x27;Map Zoom&#x27;,
        &#x27;hnp_openmaps_map_zoom_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_zoom_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_zoom&#x27;);

    // Kartenstil
    add_settings_section(
        &#x27;hnp_openmaps_osm_style_section&#x27;,
        &#x27;Map Style&#x27;,
        &#x27;hnp_openmaps_osm_style_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_style&#x27;,
        &#x27;Map Style&#x27;,
        &#x27;hnp_openmaps_map_style_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_style_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_style&#x27;);

    add_settings_section(
        &#x27;hnp_openmaps_osm_height_section&#x27;,
        &#x27;Map Height&#x27;,
        &#x27;hnp_openmaps_osm_height_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_height&#x27;,
        &#x27;Map Height&#x27;,
        &#x27;hnp_openmaps_map_height_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_height_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_height&#x27;);

    add_settings_section(
        &#x27;hnp_openmaps_osm_width_section&#x27;,
        &#x27;Map Width&#x27;,
        &#x27;hnp_openmaps_osm_width_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
    add_settings_field(
        &#x27;hnp_openmaps_map_width&#x27;,
        &#x27;Map Width&#x27;,
        &#x27;hnp_openmaps_map_width_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;,
        &#x27;hnp_openmaps_osm_width_section&#x27;
    );
    register_setting(&#x27;hnp_openmaps_osm_settings_group&#x27;, &#x27;hnp_openmaps_map_width&#x27;);

    add_settings_section(
        &#x27;hnp_openmaps_shortcode_section&#x27;,
        &#x27;Shortcode&#x27;,
        &#x27;hnp_openmaps_shortcode_section_callback&#x27;,
        &#x27;hnp-openmaps-osm-settings&#x27;
    );
}

</pre>
<pre>

// Callback functions for each option
function hnp_openmaps_osm_address_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Enter the address to be displayed on the map. &#x3C;br&#x3E;Format: Streetname + Housenumber, City Name + ZIP Code, Country &#x3C;br&#x3E;(Separate each part with a comma)&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_address_callback() {
    $address = get_option(&#x27;hnp_openmaps_map_address&#x27;, &#x27;Hardenbergpl. 8, 10787 Berlin, Germany&#x27;);
    echo &#x27;&#x3C;input type=&#x22;text&#x22; name=&#x22;hnp_openmaps_map_address&#x22; value=&#x22;&#x27; . esc_attr($address) . &#x27;&#x22; /&#x3E;&#x27;;
}

function hnp_openmaps_osm_name_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Enter the name for the marker to be displayed on the map.&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_name_callback() {
    $name = get_option(&#x27;hnp_openmaps_map_name&#x27;, &#x27;Berlin Zoological Garden&#x27;);
    echo &#x27;&#x3C;input type=&#x22;text&#x22; name=&#x22;hnp_openmaps_map_name&#x22; value=&#x22;&#x27; . esc_attr($name) . &#x27;&#x22; /&#x3E;&#x27;;
}

function hnp_openmaps_osm_zoom_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Set the zoom level of the map.&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_zoom_callback() {
    $zoom = get_option(&#x27;hnp_openmaps_map_zoom&#x27;, 12);
    echo &#x27;&#x3C;input type=&#x22;number&#x22; name=&#x22;hnp_openmaps_map_zoom&#x22; value=&#x22;&#x27; . esc_attr($zoom) . &#x27;&#x22; /&#x3E;&#x27;;
}
function hnp_openmaps_osm_style_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Select the map style.&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_style_callback() {
    $style = get_option(&#x27;hnp_openmaps_map_style&#x27;, &#x27;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&#x27;);
    $styles = array(
        &#x27;Standard (OpenStreetMap)&#x27; =&#x3E; &#x27;https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png&#x27;,
        &#x27;Hot&#x27; =&#x3E; &#x27;https://{s}.tile.openstreetmap.fr/hot/{z}/{x}/{y}.png&#x27;,
        &#x27;Cycle&#x27; =&#x3E; &#x27;https://tile.thunderforest.com/cycle/{z}/{x}/{y}.png&#x27;,
        &#x27;Transport&#x27; =&#x3E; &#x27;https://{s}.tile.thunderforest.com/transport/{z}/{x}/{y}.png&#x27;
        // More styles can be added here
    );
    echo &#x27;&#x3C;select name=&#x22;hnp_openmaps_map_style&#x22;&#x3E;&#x27;;
    foreach ($styles as $label =&#x3E; $url) {
        echo &#x27;&#x3C;option value=&#x22;&#x27; . esc_attr($url) . &#x27;&#x22; &#x27; . selected($style, $url, false) . &#x27;&#x3E;&#x27; . esc_html($label) . &#x27;&#x3C;/option&#x3E;&#x27;;
    }
    echo &#x27;&#x3C;/select&#x3E;&#x27;;
}

function hnp_openmaps_osm_height_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Set the height of the map.&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_height_callback() {
    $height = get_option(&#x27;hnp_openmaps_map_height&#x27;, &#x27;400px&#x27;);
    echo &#x27;&#x3C;input type=&#x22;text&#x22; name=&#x22;hnp_openmaps_map_height&#x22; value=&#x22;&#x27; . esc_attr($height) . &#x27;&#x22; /&#x3E;&#x27;;
}
function hnp_openmaps_osm_width_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Set the width of the map.&#x3C;/p&#x3E;&#x27;;
}
function hnp_openmaps_map_width_callback() {
    $width = get_option(&#x27;hnp_openmaps_map_width&#x27;, &#x27;100%&#x27;);
    echo &#x27;&#x3C;input type=&#x22;text&#x22; name=&#x22;hnp_openmaps_map_width&#x22; value=&#x22;&#x27; . esc_attr($width) . &#x27;&#x22; /&#x3E;&#x27;;
}
function hnp_openmaps_shortcode_section_callback() {
    echo &#x27;&#x3C;p&#x3E;Shortcode: &#x26;#x5B;hnp_openmaps_display_map_with_pin]&#x3C;/p&#x3E;&#x27;;
}

// Register plugin options and security measures
add_action(&#x27;admin_init&#x27;, &#x27;hnp_openmaps_register_plugin_options&#x27;);

// Security measures: Nonce verification for options update
function hnp_openmaps_validate_settings($input) {
    return $input; // Simply return the input, no further validation here
}

// Security measures: Nonce verification and save options
function hnp_openmaps_register_security_options() {
    // Check if the current page is our plugin options page
    if (isset($_POST[&#x27;option_page&#x27;]) &#x26;&#x26; $_POST[&#x27;option_page&#x27;] == &#x27;hnp_openmaps_osm_settings_group&#x27;) {
        // Check if the nonce is set and valid
        if (!isset($_POST[&#x27;hnp_openmaps_osm_settings_nonce&#x27;]) || !wp_verify_nonce($_POST[&#x27;hnp_openmaps_osm_settings_nonce&#x27;], &#x27;hnp_openmaps_osm_settings_nonce&#x27;)) {
            // Unauthorized request, do not save options
            wp_die(&#x27;Unauthorized request.&#x27;); // Output error message for unauthorized requests
        }

        // Save options
        update_option(&#x27;hnp_openmaps_map_address&#x27;, $_POST[&#x27;hnp_openmaps_map_address&#x27;]);
        update_option(&#x27;hnp_openmaps_map_name&#x27;, $_POST[&#x27;hnp_openmaps_map_name&#x27;]);
        update_option(&#x27;hnp_openmaps_map_zoom&#x27;, $_POST[&#x27;hnp_openmaps_map_zoom&#x27;]);
        update_option(&#x27;hnp_openmaps_map_style&#x27;, $_POST[&#x27;hnp_openmaps_map_style&#x27;]);
        update_option(&#x27;hnp_openmaps_map_height&#x27;, $_POST[&#x27;hnp_openmaps_map_height&#x27;]);
        update_option(&#x27;hnp_openmaps_map_width&#x27;, $_POST[&#x27;hnp_openmaps_map_width&#x27;]);
    }
}
add_action(&#x27;admin_init&#x27;, &#x27;hnp_openmaps_register_security_options&#x27;);

</pre>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/10/hnp-openstreetmap-kostenloses-plugin/">HNP OpenStreetMap kostenloses Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/10/hnp-openstreetmap-kostenloses-plugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Dynamische Templates in WordPress erzeugen &#038; einbinden</title>
		<link>https://homepage-nach-preis.de/2024/04/07/dynamische-templates-in-wordpress-erzeugen-einbinden/</link>
					<comments>https://homepage-nach-preis.de/2024/04/07/dynamische-templates-in-wordpress-erzeugen-einbinden/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Sun, 07 Apr 2024 16:20:29 +0000</pubDate>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Dynamische]]></category>
		<category><![CDATA[einbinden]]></category>
		<category><![CDATA[Funktion]]></category>
		<category><![CDATA[Templates]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8161</guid>

					<description><![CDATA[<p>Das &#8220;HNP Dyn Template&#8221; Plugin ermöglicht es Benutzern, zwischen verschiedenen Vorlagen für eine bestimmte Seite oder einen Beitrag zu wählen. Durch Hinzufügen von Shortcodes können Benutzer auf einfache Weise zwischen verschiedenen Templates hin- und herwechseln, ohne den Code manuell bearbeiten zu müssen. Code-Beschreibung: Shortcodes: Das Plugin fügt zwei Shortcodes hinzu: hnp_template_switcher und hnp_template_switcher_buttons. hnp_template_switcher: Dieser Shortcode rendert den Bereich, in dem das ausgewählte Template dynamisch geladen wird. Es verwendet eine PHP-Include-Anweisung, um die entsprechende Template-Datei zu laden. hnp_template_switcher_buttons: Dieser Shortcode rendert die Schaltflächen, mit denen Benutzer zwischen den verschiedenen Templates wählen können. Es gibt zwei Schaltflächen, um Template 1 und Template 2 zu laden. JavaScript: Das Plugin verwendet JavaScript, um auf Benutzerinteraktionen zu reagieren und die Templates dynamisch zu laden. Es bindet Klickereignisse an die Schaltflächen, um die entsprechenden Templates zu laden. Dazu wird eine XMLHttpRequest verwendet, um die Template-Dateien abzurufen und sie dann in den Container zu rendern. Vorteile und Nutzen: Benutzerfreundlichkeit: Das Plugin macht es einfach, zwischen verschiedenen Vorlagen zu wechseln, ohne dass Benutzer den Code bearbeiten müssen. Durch die Verwendung von Shortcodes können Benutzer die Schaltflächen und den Template-Bereich einfach in ihre Seiten und Beiträge einfügen. Flexibilität: Benutzer können verschiedene Templates erstellen und sie je nach Bedarf....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/07/dynamische-templates-in-wordpress-erzeugen-einbinden/">Dynamische Templates in WordPress erzeugen &#038; einbinden</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das &#8220;HNP Dyn Template&#8221; Plugin ermöglicht es Benutzern, zwischen verschiedenen Vorlagen für eine bestimmte Seite oder einen Beitrag zu wählen. Durch Hinzufügen von Shortcodes können Benutzer auf einfache Weise zwischen verschiedenen Templates hin- und herwechseln, ohne den Code manuell bearbeiten zu müssen.</p>
<p><strong>Code-Beschreibung:</strong></p>
<p>Shortcodes: Das Plugin fügt zwei Shortcodes hinzu: hnp_template_switcher und hnp_template_switcher_buttons.</p>
<p>hnp_template_switcher: Dieser Shortcode rendert den Bereich, in dem das ausgewählte Template dynamisch geladen wird. Es verwendet eine PHP-Include-Anweisung, um die entsprechende Template-Datei zu laden.</p>
<p>hnp_template_switcher_buttons: Dieser Shortcode rendert die Schaltflächen, mit denen Benutzer zwischen den verschiedenen Templates wählen können. Es gibt zwei Schaltflächen, um Template 1 und Template 2 zu laden.</p>
<p>JavaScript: Das Plugin verwendet JavaScript, um auf Benutzerinteraktionen zu reagieren und die Templates dynamisch zu laden. Es bindet Klickereignisse an die Schaltflächen, um die entsprechenden Templates zu laden. Dazu wird eine XMLHttpRequest verwendet, um die Template-Dateien abzurufen und sie dann in den Container zu rendern.</p>
<p><strong>Vorteile und Nutzen:</strong></p>
<p>Benutzerfreundlichkeit: Das Plugin macht es einfach, zwischen verschiedenen Vorlagen zu wechseln, ohne dass Benutzer den Code bearbeiten müssen. Durch die Verwendung von Shortcodes können Benutzer die Schaltflächen und den Template-Bereich einfach in ihre Seiten und Beiträge einfügen.</p>
<p>Flexibilität: Benutzer können verschiedene Templates erstellen und sie je nach Bedarf anpassen. Dies ermöglicht es, verschiedene Layouts und Designs für verschiedene Zwecke zu verwenden.</p>
<p>Zeitersparnis: Durch die Verwendung des Plugins können Benutzer Zeit sparen, da sie nicht jedes Mal den Code ändern müssen, wenn sie ein anderes Template verwenden möchten. Stattdessen können sie einfach die entsprechende Schaltfläche anklicken.</p>
<p><strong>Umfang:</strong></p>
<p>Das Plugin umfasst zwei Hauptkomponenten: die Shortcodes für den Template-Switcher und die zugehörige JavaScript-Funktionalität. Die Shortcodes sind einfach zu verwenden und erfordern nur minimale Konfiguration, während das JavaScript für die dynamische Laden der Templates sorgt.</p>
<p><strong>Lizenz:</strong></p>
<p>Das &#8220;HNP Dyn Template&#8221; Plugin wird unter der GNU General Public License (GPLv3) vertrieben, was bedeutet, dass es frei verwendet, modifiziert und weitergegeben werden kann, solange die Lizenzbedingungen eingehalten werden.</p>
<p><strong>Download:</strong><br />
WordPress Plugin mit Ajax: [sdm_download id=&#8221;8168&#8243; fancy=&#8221;0&#8243;]<br />
WordPress Plugin ohne Ajax: [sdm_download id=&#8221;8171&#8243; fancy=&#8221;0&#8243;]</p>
<p><strong>WordPress Plugin Code ohne Ajax (schnellere Ladezeiten):</strong></p>
<pre>&lt;?php
/*
* Plugin Name: HNP Dyn Template
* Plugin URI: https://homepage-nach-preis.de/
* Description: Erstellt 2 Button welche bei Betätigung die Template-Datei auswechseln. Shortcodes: hnp_template_switcher_buttons und hnp_template_switcher
* Version: 1.1
* Author: HNP
* Author URI: https://homepage-nach-preis.de/
* License: GPLv3
*/

// Shortcode für den Template-Switcher hinzufügen
add_shortcode('hnp_template_switcher', 'hnp_custom_template_switcher_shortcode');

// Funktion zum Rendern des Shortcodes
function hnp_custom_template_switcher_shortcode() {
    ob_start();
    ?&gt;
    &lt;div id="hnp-template-container"&gt;
        &lt;!-- Hier wird das Template dynamisch geladen --&gt;
        &lt;?php include_once(plugin_dir_path(__FILE__) . '/templates/hnp_template_1.php'); ?&gt;
    &lt;/div&gt;
    &lt;?php
    return ob_get_clean();
}

// Shortcode für die Schaltflächen zum Wechseln der Templates hinzufügen
add_shortcode('hnp_template_switcher_buttons', 'hnp_custom_template_switcher_buttons_shortcode');

// Funktion zum Rendern des Shortcodes für die Schaltflächen
function hnp_custom_template_switcher_buttons_shortcode() {
    ob_start();
    ?&gt;
    &lt;button id="hnp-template1-btn"&gt;Template 1 laden&lt;/button&gt;
    &lt;button id="hnp-template2-btn"&gt;Template 2 laden&lt;/button&gt;
    &lt;?php
    return ob_get_clean();
}

// JavaScript zum Schalten der Templates hinzufügen
add_action('wp_footer', 'hnp_custom_template_switcher_js');

function hnp_custom_template_switcher_js() {
    ?&gt;
    &lt;script&gt;
    document.addEventListener('DOMContentLoaded', function() {
        document.getElementById('hnp-template1-btn').addEventListener('click', function() {
            loadTemplate('hnp_template_1.php');
        });
        document.getElementById('hnp-template2-btn').addEventListener('click', function() {
            loadTemplate('hnp_template_2.php');
        });
    });

	function loadTemplate(templateUrl) {
		var xhr = new XMLHttpRequest();
		xhr.open('GET', '&lt;?php echo plugins_url("templates/", __FILE__); ?&gt;' + templateUrl, true);
		xhr.onreadystatechange = function() {
			if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {
				document.getElementById('hnp-template-container').innerHTML = xhr.responseText;
			}
		};
		xhr.send();
	}

    &lt;/script&gt;
    &lt;?php
}

</pre>
<p><strong>Template 1 Datei:</strong></p>
<pre>&lt;?php
/*
Template Name: Template 1
*/
?&gt;

&lt;div class="hnp-template-content"&gt;
    &lt;h2&gt;Template 1&lt;/h2&gt;
    &lt;p&gt;Dies ist der Inhalt von Template 1.&lt;/p&gt;
&lt;/div&gt;

</pre>
<p><strong>Template 2 Datei:</strong></p>
<pre>&lt;?php
/*
Template Name: Template 2
*/
?&gt;

&lt;div class="hnp-template-content"&gt;
    &lt;h2&gt;Template 2&lt;/h2&gt;
    &lt;p&gt;Dies ist der Inhalt von Template 2.&lt;/p&gt;
&lt;/div&gt;

</pre>
<p><strong>WordPress Plugin Code mit Ajax:</strong></p>
<pre>&lt;?php
/*
* Plugin Name: HNP Dyn Template
* Plugin URI: https://homepage-nach-preis.de/
* Description: Erstellt 2 Button welche bei Betätigung die Template-Datei auswechseln. Shortcodes: hnp_template_switcher_buttons und hnp_template_switcher
* Version: 1.1
* Author: HNP
* Author URI: https://homepage-nach-preis.de/
* License: HNP-Dyn-Template
*/

// Shortcode für den Template-Switcher hinzufügen
add_shortcode('hnp_template_switcher', 'hnp_custom_template_switcher_shortcode');

// Funktion zum Rendern des Shortcodes
function hnp_custom_template_switcher_shortcode() {
    ob_start();
    ?&gt;
    &lt;div id="hnp-template-container"&gt;
        &lt;!-- Hier wird das Template dynamisch geladen --&gt;
        &lt;?php include_once(plugin_dir_path(__FILE__) . '/templates/hnp_template_1.php'); ?&gt;
    &lt;/div&gt;
    &lt;?php
    return ob_get_clean();
}

// Shortcode für die Schaltflächen zum Wechseln der Templates hinzufügen
add_shortcode('hnp_template_switcher_buttons', 'hnp_custom_template_switcher_buttons_shortcode');

// Funktion zum Rendern des Shortcodes für die Schaltflächen
function hnp_custom_template_switcher_buttons_shortcode() {
    ob_start();
    ?&gt;
    &lt;button id="hnp-template1-btn"&gt;Template 1 laden&lt;/button&gt;
    &lt;button id="hnp-template2-btn"&gt;Template 2 laden&lt;/button&gt;
    &lt;?php
    return ob_get_clean();
}

// JavaScript zum Schalten der Templates hinzufügen
add_action('wp_footer', 'hnp_custom_template_switcher_js');

function hnp_custom_template_switcher_js() {
    wp_enqueue_script('hnp-custom-template-switcher', plugin_dir_url(__FILE__) . 'hnp_dyn_template.js', array('jquery'), null, true);

    wp_localize_script('hnp-custom-template-switcher', 'hnpTemplateSwitcher', array(
        'ajaxurl' =&gt; admin_url('admin-ajax.php')
    ));
}

// Ajax
add_action('wp_ajax_load_template', 'hnp_load_template_ajax');
add_action('wp_ajax_nopriv_load_template', 'hnp_load_template_ajax');

function hnp_load_template_ajax() {
    $template = isset($_GET['template']) ? $_GET['template'] : '';

    if ($template) {
        // Hier können Sie die Template-Datei laden und den Inhalt zurückgeben
        include(plugin_dir_path(__FILE__) . '/templates/' . $template);
    }

    wp_die();
}
</pre>
<p><strong>Javascript:</strong></p>
<pre>document.addEventListener('DOMContentLoaded', function() {
    document.getElementById('hnp-template1-btn').addEventListener('click', function() {
        loadTemplate('hnp_template_1.php');
    });
    document.getElementById('hnp-template2-btn').addEventListener('click', function() {
        loadTemplate('hnp_template_2.php');
    });
});

function loadTemplate(templateUrl) {
    var xhr = new XMLHttpRequest();
    xhr.open('GET', hnpTemplateSwitcher.ajaxurl + '?action=load_template&amp;template=' + templateUrl, true);
    xhr.onreadystatechange = function() {
        if (xhr.readyState === 4 &amp;&amp; xhr.status === 200) {
            document.getElementById('hnp-template-container').innerHTML = xhr.responseText;
        }
    };
    xhr.send();
}

</pre>
<p>Template Dateien hierbei identisch.</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/07/dynamische-templates-in-wordpress-erzeugen-einbinden/">Dynamische Templates in WordPress erzeugen &#038; einbinden</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/07/dynamische-templates-in-wordpress-erzeugen-einbinden/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Ajax und WP-Ajax verstehen &#8211; Code Beispiel</title>
		<link>https://homepage-nach-preis.de/2024/04/06/ajax-und-wp-ajax-verstehen-code-beispiel/</link>
					<comments>https://homepage-nach-preis.de/2024/04/06/ajax-und-wp-ajax-verstehen-code-beispiel/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Sat, 06 Apr 2024 04:00:17 +0000</pubDate>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Ajax]]></category>
		<category><![CDATA[Beispiel]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[verstehen]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Wp-Ajax]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8156</guid>

					<description><![CDATA[<p>AJAX (Asynchronous JavaScript and XML) ist eine Technik, die es ermöglicht, Daten zwischen dem Browser des Benutzers und dem Server auszutauschen, ohne die gesamte Webseite neu zu laden. Dies ermöglicht eine verbesserte Benutzererfahrung, da Inhalte dynamisch aktualisiert werden können, ohne die Seite zu verlassen. Stellen wir uns ein Restaurant vor und einen Kunden, der Kunde erhält seine Bestellung, ohne zum Restaurant fahren zu müssen, also vergleichbar mit einem Lieferanten. AJAX ist die Verbindung zwischen Server und Client, ein praktischer Helfer. Die grundlegende Arbeitsweise von AJAX besteht darin, dass der Browser mithilfe von JavaScript eine HTTP-Anfrage an den Server sendet. Der Server verarbeitet dann die Anfrage und sendet eine Antwort zurück, die vom JavaScript-Code auf der Client-Seite verarbeitet wird. In der Regel werden AJAX-Anfragen verwendet, um Daten im Hintergrund zu laden, Benutzeraktionen zu verarbeiten oder mit einem Server zu kommunizieren, ohne dass die Seite neu geladen werden muss. Dies kann beispielsweise bei der Validierung von Formularen, dem Laden von zusätzlichen Inhalten oder der Aktualisierung von Benutzerdaten nützlich sein. Um AJAX in einer Webseite zu implementieren, wird normalerweise JavaScript verwendet, um die Anfrage zu senden, und auf der Serverseite wird die Anfrage mit einer Programmiersprache wie PHP oder Python verarbeitet. In WordPress....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/06/ajax-und-wp-ajax-verstehen-code-beispiel/">Ajax und WP-Ajax verstehen &#8211; Code Beispiel</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>AJAX (Asynchronous JavaScript and XML) ist eine Technik, die es ermöglicht, Daten zwischen dem Browser des Benutzers und dem Server auszutauschen, ohne die gesamte Webseite neu zu laden. Dies ermöglicht eine verbesserte Benutzererfahrung, da Inhalte dynamisch aktualisiert werden können, ohne die Seite zu verlassen. Stellen wir uns ein Restaurant vor und einen Kunden, der Kunde erhält seine Bestellung, ohne zum Restaurant fahren zu müssen, also vergleichbar mit einem Lieferanten. AJAX ist die Verbindung zwischen Server und Client, ein praktischer Helfer. </p>
<p>Die grundlegende Arbeitsweise von AJAX besteht darin, dass der Browser mithilfe von JavaScript eine HTTP-Anfrage an den Server sendet. Der Server verarbeitet dann die Anfrage und sendet eine Antwort zurück, die vom JavaScript-Code auf der Client-Seite verarbeitet wird.</p>
<p>In der Regel werden AJAX-Anfragen verwendet, um Daten im Hintergrund zu laden, Benutzeraktionen zu verarbeiten oder mit einem Server zu kommunizieren, ohne dass die Seite neu geladen werden muss. Dies kann beispielsweise bei der Validierung von Formularen, dem Laden von zusätzlichen Inhalten oder der Aktualisierung von Benutzerdaten nützlich sein.</p>
<p>Um AJAX in einer Webseite zu implementieren, wird normalerweise JavaScript verwendet, um die Anfrage zu senden, und auf der Serverseite wird die Anfrage mit einer Programmiersprache wie PHP oder Python verarbeitet.</p>
<p>In WordPress wird AJAX häufig verwendet, um dynamische Inhalte in Themes und Plugins zu laden, ohne die Seite neu zu laden. WordPress bietet spezielle Funktionen und Hooks für die Verarbeitung von AJAX-Anfragen, was die Implementierung erleichtert. Hierzu ein praktisches Beispiel:<br />
<strong> WordPress:</strong><br />
<strong>Javascript:</strong></p>
<pre>
document.addEventListener(&#x22;DOMContentLoaded&#x22;, function() {
    var hnpAjaxButton = document.getElementById(&#x22;hnp_ajax_button&#x22;);
    
    hnpAjaxButton.addEventListener(&#x22;click&#x22;, function() {
        var xhr = new XMLHttpRequest();
        xhr.open(&#x22;POST&#x22;, ajax_object.ajax_url, true);
        xhr.setRequestHeader(&#x22;Content-Type&#x22;, &#x22;application/x-www-form-urlencoded&#x22;);
        xhr.onreadystatechange = function() {
            if (xhr.readyState === 4 &#x26;&#x26; xhr.status === 200) {
                alert(&#x22;Server sagt: &#x22; + xhr.responseText);
            }
        };
        xhr.send(&#x22;action=hnp_ajax_funktion&#x22;);
    });
});
</pre>
<p><strong>PHP</strong></p>
<pre>
add_action(&#x27;wp_enqueue_scripts&#x27;, &#x27;hnp_ajax_scripts&#x27;);
function hnp_ajax_scripts() {
    wp_enqueue_script(&#x27;hnp-ajax-script&#x27;, get_stylesheet_directory_uri() . &#x27;/js/hnp-ajax-script.js&#x27;, array(), &#x27;1.0&#x27;, true);
    wp_localize_script(&#x27;hnp-ajax-script&#x27;, &#x27;ajax_object&#x27;, array(&#x27;ajax_url&#x27; =&#x3E; admin_url(&#x27;admin-ajax.php&#x27;)));
}

add_action(&#x27;wp_ajax_hnp_ajax_funktion&#x27;, &#x27;meine_ajax_callback&#x27;);
add_action(&#x27;wp_ajax_nopriv_hnp_ajax_funktion&#x27;, &#x27;meine_ajax_callback&#x27;);
function meine_ajax_callback() {
    echo &#x27;Hallo von AJAX!&#x27;;
    die();
}
</pre>
<p><strong>HTML:</strong></p>
<pre>
&#x3C;button id=&#x22;hnp_ajax_button&#x22;&#x3E;Klick mich f&#xFC;r eine Begr&#xFC;&#xDF;ungsnachricht!&#x3C;/button&#x3E;
</pre>
<p><strong>ODER Universal:</strong></p>
<pre>
&#x3C;!DOCTYPE html&#x3E;
&#x3C;html lang=&#x22;en&#x22;&#x3E;
&#x3C;head&#x3E;
    &#x3C;meta charset=&#x22;UTF-8&#x22;&#x3E;
    &#x3C;meta name=&#x22;viewport&#x22; content=&#x22;width=device-width, initial-scale=1.0&#x22;&#x3E;
    &#x3C;title&#x3E;AJAX Beispiel&#x3C;/title&#x3E;
&#x3C;/head&#x3E;
&#x3C;body&#x3E;
    &#x3C;button id=&#x22;hnp_ajax_button&#x22;&#x3E;Klick mich f&#xFC;r eine Begr&#xFC;&#xDF;ungsnachricht!&#x3C;/button&#x3E;

    &#x3C;script&#x3E;
        document.addEventListener(&#x22;DOMContentLoaded&#x22;, function() {
            var hnpAjaxButton = document.getElementById(&#x22;hnp_ajax_button&#x22;);
            
            hnpAjaxButton.addEventListener(&#x22;click&#x22;, function() {
                var xhr = new XMLHttpRequest();
                xhr.open(&#x22;POST&#x22;, &#x22;server.php&#x22;, true); // Hier &#x22;server.php&#x22; durch die URL des Servers ersetzen, der die AJAX-Anfrage verarbeitet
                xhr.setRequestHeader(&#x22;Content-Type&#x22;, &#x22;application/x-www-form-urlencoded&#x22;);
                xhr.onreadystatechange = function() {
                    if (xhr.readyState === 4 &#x26;&#x26; xhr.status === 200) {
                        alert(&#x22;Server sagt: &#x22; + xhr.responseText);
                    }
                };
                xhr.send(&#x22;action=hnp_ajax_funktion&#x22;);
            });
        });
    &#x3C;/script&#x3E;
&#x3C;/body&#x3E;
&#x3C;/html&#x3E;

</pre>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/06/ajax-und-wp-ajax-verstehen-code-beispiel/">Ajax und WP-Ajax verstehen &#8211; Code Beispiel</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/06/ajax-und-wp-ajax-verstehen-code-beispiel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bild austauschen bei Maus Hover Funktion</title>
		<link>https://homepage-nach-preis.de/2024/04/04/bild-austauschen-bei-maus-hover-funktion/</link>
					<comments>https://homepage-nach-preis.de/2024/04/04/bild-austauschen-bei-maus-hover-funktion/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Thu, 04 Apr 2024 08:03:24 +0000</pubDate>
				<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Bild. Austausch]]></category>
		<category><![CDATA[Change]]></category>
		<category><![CDATA[Hover]]></category>
		<category><![CDATA[Maus]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8148</guid>

					<description><![CDATA[<p>Einfache Funktion, um ein Bild auszuwechseln, sobald sich die Maus über dem Bild befindet. Also eine Hover-Change-Image Funktion. HTML Code: &#x3C;div class=&#x22;hnp_container&#x22; onmouseover=&#x22;hnp_showImage2()&#x22; onmouseout=&#x22;hnp_showImage1()&#x22;&#x3E; &#x3C;img class=&#x22;hnp_image&#x22; src=&#x22;WWW.IHRE-WEBSEITE.DE/BILDDATEI-1.JPG&#x22; alt=&#x22;Image 1&#x22;&#x3E; &#x3C;img class=&#x22;hnp_image hnp_image2&#x22; src=&#x22;WWW.IHRE-WEBSEITE.DE/BILDDATEI-2.JPG&#038;&#x22; alt=&#x22;Image 2&#x22;&#x3E; &#x3C;/div&#x3E; Javascript Code: &#x3C;script&#x3E; function hnp_showImage2() { document.querySelector(&#x27;.hnp_image&#x27;).style.display = &#x27;none&#x27;; document.querySelector(&#x27;.hnp_image2&#x27;).style.display = &#x27;block&#x27;; } function hnp_showImage1() { document.querySelector(&#x27;.hnp_image&#x27;).style.display = &#x27;block&#x27;; document.querySelector(&#x27;.hnp_image2&#x27;).style.display = &#x27;none&#x27;; } &#x3C;/script&#x3E; Css: &#x3C;style&#x3E; .hnp_container { position: relative; width: 300px; height: 300px; } .hnp_image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } .hnp_image2 { display: none; } &#x3C;/style&#x3E;</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/bild-austauschen-bei-maus-hover-funktion/">Bild austauschen bei Maus Hover Funktion</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Einfache Funktion, um ein Bild auszuwechseln, sobald sich die Maus über dem Bild befindet. Also eine Hover-Change-Image Funktion. </p>
<p><strong>HTML Code:</strong></p>
<pre>
&#x3C;div class=&#x22;hnp_container&#x22; onmouseover=&#x22;hnp_showImage2()&#x22; onmouseout=&#x22;hnp_showImage1()&#x22;&#x3E;
  &#x3C;img class=&#x22;hnp_image&#x22; src=&#x22;WWW.IHRE-WEBSEITE.DE/BILDDATEI-1.JPG&#x22; alt=&#x22;Image 1&#x22;&#x3E;
  &#x3C;img class=&#x22;hnp_image hnp_image2&#x22; src=&#x22;WWW.IHRE-WEBSEITE.DE/BILDDATEI-2.JPG&&#x22; alt=&#x22;Image 2&#x22;&#x3E;
&#x3C;/div&#x3E;
</pre>
<p><strong>Javascript Code:</strong></p>
<pre>
&#x3C;script&#x3E;
  function hnp_showImage2() {
    document.querySelector(&#x27;.hnp_image&#x27;).style.display = &#x27;none&#x27;;
    document.querySelector(&#x27;.hnp_image2&#x27;).style.display = &#x27;block&#x27;;
  }

  function hnp_showImage1() {
    document.querySelector(&#x27;.hnp_image&#x27;).style.display = &#x27;block&#x27;;
    document.querySelector(&#x27;.hnp_image2&#x27;).style.display = &#x27;none&#x27;;
  }
&#x3C;/script&#x3E;
</pre>
<p><strong>Css:</strong></p>
<pre>
&#x3C;style&#x3E;
  .hnp_container {
    position: relative;
    width: 300px;
    height: 300px;
  }
  .hnp_image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
  }
  .hnp_image2 {
    display: none;
  }
&#x3C;/style&#x3E;
</pre>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/bild-austauschen-bei-maus-hover-funktion/">Bild austauschen bei Maus Hover Funktion</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/04/bild-austauschen-bei-maus-hover-funktion/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>HNP Variable CSS WordPress Plugin</title>
		<link>https://homepage-nach-preis.de/2024/04/04/hnp-variable-css-wordpress-plugin/</link>
					<comments>https://homepage-nach-preis.de/2024/04/04/hnp-variable-css-wordpress-plugin/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Thu, 04 Apr 2024 03:18:54 +0000</pubDate>
				<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[Css]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[Var]]></category>
		<category><![CDATA[Variable]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8140</guid>

					<description><![CDATA[<p>Das HNP Variable CSS WordPress Plugin ist eine Erweiterung für WordPress-Websites, die eine einfache Möglichkeit bietet, CSS-Variablen oder CSS-Custom-Properties zu verwenden. Nach der Installation und Aktivierung des Plugins können Sie Ihre gewünschten Werte in den Plugin-Optionen festlegen und anschließend diese festgelegten CSS-Variablen in Ihrem Theme verwenden. Dadurch können Sie Ihre Website modern gestalten und zukunftssicher machen, oder sogar das Plugin für Funktionen wie einen Dark Mode nutzen (diese Funktion erfordert möglicherweise zusätzliche Anpassungen). Folgende CSS-Variablen stehen zur Verfügung: hnp_primary-color hnp_secondary-color hnp_tertiary-color hnp_quaternary-color hnp_quinary-color hnp_font-size-small hnp_font-size-medium hnp_font-size-large hnp_font-weight-normal hnp_font-weight-bold hnp_font-weight-light hnp_font-family-primary hnp_font-family-secondary hnp_padding-small hnp_padding-big hnp_transparency-low hnp_transparency-high hnp_margin-small hnp_margin-big &#160; Zusammenfassung der Funktionen: Erstellt eine Optionen-Seite im Plugin, um die VAR CSS-Werte festzulegen und zu speichern. Verwendet JavaScript (ohne jQuery), um die Variablen mit dem CSS zu verbinden. Nutzen Sie die CSS-Variablen für Container, Schriftarten oder andere Stilelemente in Ihrem Theme. &#160; Mehr Information und Download: HNP Variable CSS WordPress Plugin</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/hnp-variable-css-wordpress-plugin/">HNP Variable CSS WordPress Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Das HNP Variable CSS WordPress Plugin ist eine Erweiterung für WordPress-Websites, die eine einfache Möglichkeit bietet, CSS-Variablen oder CSS-Custom-Properties zu verwenden. Nach der Installation und Aktivierung des Plugins können Sie Ihre gewünschten Werte in den Plugin-Optionen festlegen und anschließend diese festgelegten CSS-Variablen in Ihrem Theme verwenden. Dadurch können Sie Ihre Website modern gestalten und zukunftssicher machen, oder sogar das Plugin für Funktionen wie einen Dark Mode nutzen (diese Funktion erfordert möglicherweise zusätzliche Anpassungen).</p>
<p><img decoding="async" class="alignnone size-medium wp-image-8144" src="https://homepage-nach-preis.de/wp-content/uploads/2024/04/var-css-wordpress-300x161.jpg" alt="" width="300" height="161" srcset="https://homepage-nach-preis.de/wp-content/uploads/2024/04/var-css-wordpress-300x161.jpg 300w, https://homepage-nach-preis.de/wp-content/uploads/2024/04/var-css-wordpress.jpg 402w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p><strong>Folgende CSS-Variablen stehen zur Verfügung:</strong></p>
<ul>
<li>hnp_primary-color</li>
<li>hnp_secondary-color</li>
<li>hnp_tertiary-color</li>
<li>hnp_quaternary-color</li>
<li>hnp_quinary-color</li>
<li>hnp_font-size-small</li>
<li>hnp_font-size-medium</li>
<li>hnp_font-size-large</li>
<li>hnp_font-weight-normal</li>
<li>hnp_font-weight-bold</li>
<li>hnp_font-weight-light</li>
<li>hnp_font-family-primary</li>
<li>hnp_font-family-secondary</li>
<li>hnp_padding-small</li>
<li>hnp_padding-big</li>
<li>hnp_transparency-low</li>
<li>hnp_transparency-high</li>
<li>hnp_margin-small</li>
<li>hnp_margin-big</li>
</ul>
<p>&nbsp;</p>
<p><strong>Zusammenfassung der Funktionen:</strong></p>
<ul>
<li>Erstellt eine Optionen-Seite im Plugin, um die VAR CSS-Werte festzulegen und zu speichern.</li>
<li>Verwendet JavaScript (ohne jQuery), um die Variablen mit dem CSS zu verbinden.</li>
<li>Nutzen Sie die CSS-Variablen für Container, Schriftarten oder andere Stilelemente in Ihrem Theme.</li>
</ul>
<p>&nbsp;</p>
<p><strong>Mehr Information und Download:</strong><br />
<a href="https://shop.homepage-nach-preis.de/produkt/hnp-variable-css-wordpress-plugin/" target="_blank" rel="nofollow noopener">HNP Variable CSS WordPress Plugin</a></p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/hnp-variable-css-wordpress-plugin/">HNP Variable CSS WordPress Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/04/hnp-variable-css-wordpress-plugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Temporäre Produkte WooCommerce Plugin</title>
		<link>https://homepage-nach-preis.de/2024/04/04/temporaere-produkte-woocommerce-plugin/</link>
					<comments>https://homepage-nach-preis.de/2024/04/04/temporaere-produkte-woocommerce-plugin/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Thu, 04 Apr 2024 03:14:39 +0000</pubDate>
				<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Onlineshop]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[Produkte]]></category>
		<category><![CDATA[temp]]></category>
		<category><![CDATA[Temporäre]]></category>
		<category><![CDATA[Woocommerce]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8135</guid>

					<description><![CDATA[<p>Das HNP Temp Product WooCommerce Plugin erweitert WordPress-Websites, die WooCommerce verwenden, um temporäre Produkte zu verkaufen. Mit einem einfachen Shortcode können Sie einen &#8220;Warenkorb&#8221; -Button hinzufügen, der es Benutzern ermöglicht, individuelle temporäre Produkte direkt in den Warenkorb zu legen. Dieses temporäre Produkt wird automatisch erstellt, sobald der Button gedrückt wird, ohne dass Sie ein spezielles WooCommerce-Produkt erstellen müssen. Nach einer bestimmten Zeit kann das Produkt automatisch aus dem Warenkorb entfernt werden. Zusammenfassung der Funktionen: Einfache Integration: Der Warenkorb-Button kann überall auf der Website platziert werden. Automatische Produkterstellung: Das Drücken des Buttons erstellt automatisch ein temporäres Produkt im Warenkorb. Benutzerfreundlichkeit: Benutzer werden automatisch zum Warenkorb weitergeleitet. Flexibilität: Das Plugin ermöglicht es Entwicklern, das Verhalten des Buttons durch Hinzufügen einer Post-ID anzupassen, um Daten von benutzerdefinierten Beitragstypen oder Blogbeiträgen zu nutzen. Sicherheit: Das Plugin enthält Sicherheitsoptimierungen gegen XSS-Angriffe und direkte Datei-Aufrufe. Performance: Verwendet direktes Javascript ohne jQuery und keine externen Bibliotheken, was zu einer guten Leistung führt. Kompatibel mit PHP 7.x und 8.x. &#160; Mehr Informationen und Download: Temporäre Produkte WooCommerce Plugin</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/temporaere-produkte-woocommerce-plugin/">Temporäre Produkte WooCommerce Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img decoding="async" class="alignnone size-medium wp-image-8137" src="https://homepage-nach-preis.de/wp-content/uploads/2024/04/temp-produkt-1-300x141.jpg" alt="" width="300" height="141" srcset="https://homepage-nach-preis.de/wp-content/uploads/2024/04/temp-produkt-1-300x141.jpg 300w, https://homepage-nach-preis.de/wp-content/uploads/2024/04/temp-produkt-1.jpg 396w" sizes="(max-width: 300px) 100vw, 300px" /></p>
<p>Das HNP Temp Product WooCommerce Plugin erweitert WordPress-Websites, die WooCommerce verwenden, um temporäre Produkte zu verkaufen. Mit einem einfachen Shortcode können Sie einen &#8220;Warenkorb&#8221; -Button hinzufügen, der es Benutzern ermöglicht, individuelle temporäre Produkte direkt in den Warenkorb zu legen. Dieses temporäre Produkt wird automatisch erstellt, sobald der Button gedrückt wird, ohne dass Sie ein spezielles WooCommerce-Produkt erstellen müssen. Nach einer bestimmten Zeit kann das Produkt automatisch aus dem Warenkorb entfernt werden.</p>
<p><strong>Zusammenfassung der Funktionen:</strong></p>
<ul>
<li>Einfache Integration: Der Warenkorb-Button kann überall auf der Website platziert werden.</li>
<li>Automatische Produkterstellung: Das Drücken des Buttons erstellt automatisch ein temporäres Produkt im Warenkorb.</li>
<li>Benutzerfreundlichkeit: Benutzer werden automatisch zum Warenkorb weitergeleitet.</li>
<li>Flexibilität: Das Plugin ermöglicht es Entwicklern, das Verhalten des Buttons durch Hinzufügen einer Post-ID anzupassen, um Daten von benutzerdefinierten Beitragstypen oder Blogbeiträgen zu nutzen.</li>
<li>Sicherheit: Das Plugin enthält Sicherheitsoptimierungen gegen XSS-Angriffe und direkte Datei-Aufrufe.</li>
<li>Performance: Verwendet direktes Javascript ohne jQuery und keine externen Bibliotheken, was zu einer guten Leistung führt. Kompatibel mit PHP 7.x und 8.x.</li>
</ul>
<p>&nbsp;</p>
<p><strong>Mehr Informationen und Download:</strong><br />
<a href="https://shop.homepage-nach-preis.de/produkt/hnp-temporaere-woocommerce-produkte/" target="_blank" rel="nofollow noopener">Temporäre Produkte WooCommerce Plugin</a></p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/04/temporaere-produkte-woocommerce-plugin/">Temporäre Produkte WooCommerce Plugin</a> erschien zuerst auf <a rel="nofollow" href="https://homepage-nach-preis.de">Homepage nach Preis - Webseite erstellen lassen</a>. Geschrieben von <a rel="nofollow" href="https://homepage-nach-preis.de/author/homepageadmin/">Homepage-nach-Preis</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2024/04/04/temporaere-produkte-woocommerce-plugin/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
