<?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>Shortcode Archiv - Homepage nach Preis - Webseite erstellen lassen</title>
	<atom:link href="https://homepage-nach-preis.de/wort/shortcode/feed/" rel="self" type="application/rss+xml" />
	<link></link>
	<description>★ Responsive Webdesigner Homepage erstellen lassen, bereits ab 299 Euro professionelle Webseite. ✓ Google-Optimiert ✓ Mobil-Optimiert &#124; Webdesign &#38; Seo</description>
	<lastBuildDate>Thu, 23 May 2024 15:13:45 +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>Shortcode Archiv - Homepage nach Preis - Webseite erstellen lassen</title>
	<link></link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>HNP WIN SHORTCODE Tool: Eine Revolution für WordPress</title>
		<link>https://homepage-nach-preis.de/2024/04/26/hnp-win-shortcode-tool-eine-revolution-fuer-wordpress/</link>
					<comments>https://homepage-nach-preis.de/2024/04/26/hnp-win-shortcode-tool-eine-revolution-fuer-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Fri, 26 Apr 2024 19:13:58 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Homepage]]></category>
		<category><![CDATA[Onlineshop]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[API]]></category>
		<category><![CDATA[Daten]]></category>
		<category><![CDATA[Hook]]></category>
		<category><![CDATA[Shortcode]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[Verbindung]]></category>
		<category><![CDATA[Win]]></category>
		<category><![CDATA[Windows]]></category>
		<category><![CDATA[wordpress]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=8216</guid>

					<description><![CDATA[<p>Unbegrenzte Anpassung mit dem HNP WIN SHORTCODE Tool: Eine Revolution für WordPress In der Welt des Webdesigns und der Content-Verwaltungssysteme ist Flexibilität der Schlüssel. WordPress, das beliebte CMS, bietet bereits eine Vielzahl von Funktionen, aber was, wenn Sie noch weiter gehen möchten? Was ist, wenn Sie Ihre Inhalte noch individueller gestalten möchten? Hier kommt das HNP WIN SHORTCODE Tool ins Spiel &#8211; ein innovatives WordPress-Plugin in Kombination mit einer leistungsstarken Windows x64-Software, die Ihnen die unbegrenzte Erstellung und Anpassung von Shortcodes ermöglicht. Was ist das HNP WIN SHORTCODE Tool? Das HNP WIN SHORTCODE Tool besteht aus zwei Hauptkomponenten: einem WordPress-Plugin und einer Windows x64-Software. Zusammen ermöglichen sie die einfache Erstellung und Verwaltung von Shortcodes mit anpassbaren Inhalten direkt von Ihrem Desktop aus. Wie funktioniert es? Das WordPress-Plugin integriert sich nahtlos in Ihre WordPress-Installation. Nach der Installation und Aktivierung stehen Ihnen sofort alle Funktionen zur Verfügung. Sie können die Anzahl der Shortcodes festlegen und die Daten bearbeiten, alles direkt über das Backend von WordPress. Die Windows-Software bietet eine benutzerfreundliche Oberfläche, mit der Sie die Shortcodes und deren Inhalte laden und ändern können. Dank der Integration mit der WordPress-Rest-API können Sie die Änderungen direkt auf Ihrer Website veröffentlichen. Funktionen des WordPress-Plugins: Einfache....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/26/hnp-win-shortcode-tool-eine-revolution-fuer-wordpress/">HNP WIN SHORTCODE Tool: Eine Revolution für WordPress</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>Unbegrenzte Anpassung mit dem HNP WIN SHORTCODE Tool: Eine Revolution für WordPress</strong></p>
<p>In der Welt des Webdesigns und der Content-Verwaltungssysteme ist Flexibilität der Schlüssel. WordPress, das beliebte CMS, bietet bereits eine Vielzahl von Funktionen, aber was, wenn Sie noch weiter gehen möchten? Was ist, wenn Sie Ihre Inhalte noch individueller gestalten möchten? Hier kommt das HNP WIN SHORTCODE Tool ins Spiel &#8211; ein innovatives WordPress-Plugin in Kombination mit einer leistungsstarken Windows x64-Software, die Ihnen die unbegrenzte Erstellung und Anpassung von Shortcodes ermöglicht.</p>
<h3>Was ist das HNP WIN SHORTCODE Tool?</h3>
<p>Das HNP WIN SHORTCODE Tool besteht aus zwei Hauptkomponenten: einem WordPress-Plugin und einer Windows x64-Software. Zusammen ermöglichen sie die einfache Erstellung und Verwaltung von Shortcodes mit anpassbaren Inhalten direkt von Ihrem Desktop aus.</p>
<h3>Wie funktioniert es?</h3>
<p>Das WordPress-Plugin integriert sich nahtlos in Ihre WordPress-Installation. Nach der Installation und Aktivierung stehen Ihnen sofort alle Funktionen zur Verfügung. Sie können die Anzahl der Shortcodes festlegen und die Daten bearbeiten, alles direkt über das Backend von WordPress.</p>
<p>Die Windows-Software bietet eine benutzerfreundliche Oberfläche, mit der Sie die Shortcodes und deren Inhalte laden und ändern können. Dank der Integration mit der WordPress-Rest-API können Sie die Änderungen direkt auf Ihrer Website veröffentlichen.</p>
<h3>Funktionen des WordPress-Plugins:</h3>
<ul>
<li><strong>Einfache Einrichtung:</strong> Installieren und aktivieren Sie das Plugin &#8211; der Rest ist optional, da das Plugin bereits vorkonfiguriert ist.</li>
<li><strong>Backend-Verwaltung:</strong> Eine eigene Backend-Seite im Admin-Dashboard von WordPress ermöglicht die Verwaltung der Shortcodes und ihrer Inhalte.</li>
<li><strong>Anpassung:</strong> Passen Sie die Anzahl der Shortcodes an und definieren Sie die Daten, die ausgelesen und geändert werden sollen.</li>
<li><strong>Sprachunabhängig:</strong> Das Plugin ist derzeit nur in Englisch verfügbar, aber da Sie die Inhalte der Shortcodes selbst bestimmen können, ist die Sprache irrelevant.</li>
<li><strong>Performance und Sicherheit:</strong> Das Plugin nutzt pures JavaScript und ist mit PHP 7.X und PHP 8.X kompatibel. Die REST-API ist durch einen Secret Key geschützt.</li>
</ul>
<h3>Funktionen der Windows-Software:</h3>
<ul>
<li><strong>Einfache Nutzung:</strong> Starten Sie die Anwendung auf einem Windows-64-Bit-System und geben Sie Ihre Domain-Adresse ein &#8211; mehr ist nicht nötig.</li>
<li><strong>Vielseitigkeit:</strong> Die Anwendung funktioniert auf Servern, Laptops und herkömmlichen Computern.</li>
<li><strong>Anpassungsmöglichkeiten:</strong> Ändern Sie den Secret Key, die Anzahl der Shortcodes und die Domain-Adresse nach Bedarf.</li>
<li><strong>Speicherungsfunktion:</strong> Die Anwendung merkt sich die letzten Einstellungen für einen bequemen Autostart.</li>
<li><strong>Performance und Sicherheit:</strong> Nutzt keine externen Bibliotheken außer denen von Python, Netcore und GTK. Die Datenübertragung zur WordPress-Website erfolgt über die REST-API mit einem Secret Key.</li>
</ul>
<p>&nbsp;</p>
<p><strong>Mehr Informationen und Download:</strong><br />
<a href="https://shop.homepage-nach-preis.de/produkt/hnp-unlimiterte-shortcodes-schnitstelle-wordpress-windows-x64/" target="_blank" rel="nofollow noopener">https://shop.homepage-nach-preis.de/produkt/hnp-unlimiterte-shortcodes-schnitstelle-wordpress-windows-x64/</a></p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2024/04/26/hnp-win-shortcode-tool-eine-revolution-fuer-wordpress/">HNP WIN SHORTCODE Tool: Eine Revolution für WordPress</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/26/hnp-win-shortcode-tool-eine-revolution-fuer-wordpress/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>WooCommerce individuelles Badge erstellen</title>
		<link>https://homepage-nach-preis.de/2023/05/27/woocommerce-individuelles-badge-erstellen/</link>
					<comments>https://homepage-nach-preis.de/2023/05/27/woocommerce-individuelles-badge-erstellen/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Sat, 27 May 2023 19:04:12 +0000</pubDate>
				<category><![CDATA[Onlineshop]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[anzeigen]]></category>
		<category><![CDATA[Badge]]></category>
		<category><![CDATA[Funktion]]></category>
		<category><![CDATA[Neu]]></category>
		<category><![CDATA[Shortcode]]></category>
		<category><![CDATA[WooCommere]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=7714</guid>

					<description><![CDATA[<p>Individuelle zeitbasierte Badges erstellen für WooCommerce Mit diesem Code, welcher in die functions.php (im Theme-Verzeichnis von WordPress) eingefügt wird, können eigene Badges für Produkte erstellt und angezeigt werden. Funktionsübersicht Version 1: &#8211; Erstellt ein Badge basierend auf dem Erstellungsdatum des Produktes &#8211; Das Badge beinhaltet das Wort &#8220;NEU&#8221; und wird angezeigt, wenn ein Produkt innerhalb der letzten 3 Tage erstellt wurde &#8211; Die Position des Badges kann durch ein Shortcode bestimmt werden Funktionsübersicht Version 2: &#8211; Erstellt ein Badge basierend auf dem Erstellungs- und Modifikationsdatum des Produktes &#8211; Das Badge beinhaltet das Wort &#8220;NEU&#8221; und wird angezeigt, wenn ein Produkt innerhalb der letzten 3 Tage erstellt wurde &#8211; Wenn das Produkt nicht innerhalb der letzten 3 Tage erstellt wurde, wird ein Badge mit dem Word &#8220;Aktualisiert&#8221; angezeigt werden, falls das Produkt innerhalb der letzten 3 Tage aktualisiert wurde &#8211; Die Position des Badges kann durch ein Shortcode bestimmt werden Version 1: /** * WooCommerce Badge New * @since 1.0.0 */ add_action( &#x27;woocommerce_before_shop_loop_item_title&#x27;, &#x27;hnp_new_badge&#x27;, 3 ); function hnp_new_badge() { &#x9; global $product; $newness_days = 1; $created = strtotime( $product-&#x3E;get_date_created() ); if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) &#x3C; $created ) { echo &#x27;&#x3C;div....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2023/05/27/woocommerce-individuelles-badge-erstellen/">WooCommerce individuelles Badge erstellen</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[<h3>Individuelle zeitbasierte Badges erstellen für WooCommerce</h3>
<p>Mit diesem Code, welcher in die functions.php (im Theme-Verzeichnis von WordPress) eingefügt wird, können eigene Badges für Produkte erstellt und angezeigt werden.</p>
<p><strong>Funktionsübersicht Version 1: </strong><br />
&#8211; Erstellt ein Badge basierend auf dem Erstellungsdatum des Produktes<br />
&#8211; Das Badge beinhaltet das Wort &#8220;NEU&#8221; und wird angezeigt, wenn ein Produkt innerhalb der letzten 3 Tage erstellt wurde<br />
&#8211; Die Position des Badges kann durch ein Shortcode bestimmt werden</p>
<p><strong>Funktionsübersicht Version 2: </strong><br />
&#8211; Erstellt ein Badge basierend auf dem Erstellungs- und Modifikationsdatum des Produktes<br />
&#8211; Das Badge beinhaltet das Wort &#8220;NEU&#8221; und wird angezeigt, wenn ein Produkt innerhalb der letzten 3 Tage erstellt wurde<br />
&#8211; Wenn das Produkt nicht innerhalb der letzten 3 Tage erstellt wurde, wird ein Badge mit dem Word &#8220;Aktualisiert&#8221; angezeigt werden, falls das Produkt innerhalb der letzten 3 Tage aktualisiert wurde<br />
&#8211; Die Position des Badges kann durch ein Shortcode bestimmt werden</p>
<p>Version 1: </p>
<pre>/**
 * WooCommerce Badge New
 * @since 1.0.0
 */

add_action( &#x27;woocommerce_before_shop_loop_item_title&#x27;, &#x27;hnp_new_badge&#x27;, 3 );
          
function hnp_new_badge() {
&#x9;
   global $product;
   $newness_days = 1;
   $created = strtotime( $product-&#x3E;get_date_created() );
   
   if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) &#x3C; $created ) {
      echo &#x27;&#x3C;div class=&#x22;hnp_new_badge&#x22;&#x3E;Neu&#x3C;/div&#x3E;&#x27;;
   }
}


/**
 * Custom Shortcode
 * @since 1.0.0
 */


function hnp_badge_short() {
     return hnp_new_badge();
 } 

add_shortcode( &#x27;hnp_shortcode_badge&#x27;, &#x27;hnp_badge_short&#x27; );

</pre>
<p>Version 2: </p>
<pre>


/**
 * WooCommerce Badge New and Updated
 * @since 1.0.0
 */

add_action( &#x27;woocommerce_before_shop_loop_item_title&#x27;, &#x27;hnp_new_badge&#x27;, 3 );
          
function hnp_new_badge() {
&#x9;
   global $product;
   $newness_days = 1;
   $update_days = 1;
   $created = strtotime( $product-&#x3E;get_date_created() );
   $modify = strtotime( $product-&#x3E;get_date_modified() );
   
   if ( ( time() - ( 60 * 60 * 24 * $newness_days ) ) &#x3C; $created ) {
      echo &#x27;&#x3C;div class=&#x22;hnp_new_badge&#x22;&#x3E;Neu&#x3C;/div&#x3E;&#x27;;
   }
   else
   {
       if ( ( time() - ( 60 * 60 * 24 * $update_days  ) ) &#x3C; $modify ) {
           echo &#x27;&#x3C;div class=&#x22;hnp_upd_badge&#x22;&#x3E;Aktualisiert&#x3C;/div&#x3E;&#x27;;
         }  
   }
}

/**
 * Custom Shortcode
 * @since 1.0.0
 */


function hnp_badge_short() {
     return hnp_new_badge();
 } 

add_shortcode( &#x27;hnp_shortcode_badge&#x27;, &#x27;hnp_badge_short&#x27; );

</pre>
<p><strong>Das Shortcode für die Frontend-Anzeige ist:</strong></p>
<pre>[hnp_shortcode_badge]</pre>
<p>Das Shortcode kann in Widgets, Produktbeschreibungen, Texteditoren oder bei anderen Nutzungsmöglichkeiten (z.B. Pagebuildern) genutzt werden. Sollte das Shortcode in eine HTML-Datei eingefügt werden, wäre der passende Code: </p>
<pre>&#x3C;?php echo do_shortcode(&#x27;[hnp_shortcode_badge]&#x27;); ?&#x3E;</pre>
<p>Sollte das Shortcode in eine PHP Datei (mit geöffneten PHP Tag) eingebunden werden, wäre der Code: </p>
<pre>echo do_shortcode(&#x27;[hnp_shortcode_badge]&#x27;); </pre>
<p><strong>Weitere mögliche Modifikationen: </strong><br />
1. Dauer der Badge-Anzeige ändern<br />
Um die Dauer der Anzeige zu verändern, werden folgende Zeilen verändert, die Zahlen nach dem &#8220;=&#8221; sind die Tage. </p>
<pre>   $newness_days = 1;
   $update_days = 1;</pre>
<p>2. Worte austauschen<br />
Um die Worte &#8220;Neu&#8221; oder &#8220;aktualisiert&#8221; auszutauschen, werden folgende Zeilen angepasst:</p>
<pre>echo &#x27;&#x3C;div class=&#x22;hnp_new_badge&#x22;&#x3E;Neu&#x3C;/div&#x3E;&#x27;;
echo &#x27;&#x3C;div class=&#x22;hnp_upd_badge&#x22;&#x3E;Aktualisiert&#x3C;/div&#x3E;&#x27;;</pre>
<p>Die &#8221; müssen bestehen bleiben. </p>
<p>3. Andere Trigger nutzen<br />
Die aktuellen Trigger-Werte sind: </p>
<pre>$product->get_date_created
$product->get_date_modified</pre>
<p>Hierbei weitere mögliche Trigger-Werte:</p>
<pre>/**
 *
 *  General Product Data
 *
 */
$product->get_id(); // Returns the unique ID for this object.
$product->get_description(); // Get product description.
$product->get_formatted_name(); // Get product name with SKU or ID. Used within admin.
$product->get_featured(); // If the product is featured.
$product->get_name(); // Get product name.
$product->get_title(); // Get the product's title. For products this is the product name.
$product->get_type(); // Get internal type. Should return string and *should be overridden* by child classes.
$product->get_virtual(); // Get virtual.
$product->get_total_sales(); // Get number total of sales.
$product->get_short_description(); // Get product short description.
$product->get_sku(); // Get SKU (Stock-keeping unit) - product unique ID.
$product->get_slug(); // Get product slug.
$product->get_status(); // Get product status.
$product->get_permalink(); // Product permalink.
$product->get_catalog_visibility(); // Get catalog visibility.

/**
 *
 *  Pricing Data
 *
 */
$product->get_price(); // Returns the product's active price.
$product->get_date_on_sale_from(); // Get date on sale from.
$product->get_date_on_sale_to(); // Get date on sale to.
$product->get_display_price(); // Returns the price including or excluding tax, based on the 'woocommerce_tax_display_shop' setting.
$product->get_price_excluding_tax(); // Returns the price (excluding tax) - ignores tax_class filters since the price may *include* tax and thus needs subtracting.
$product->get_price_html(); // Returns the price in html format.
$product->get_price_html_from_text(); // Functions for getting parts of a price, in html, used by $product->get_price_html.
$product->get_price_html_from_to(); // Functions for getting parts of a price, in html, used by $product->get_price_html.
$product->get_price_including_tax(); // Returns the price (including tax). Uses customer tax rates. Can work for a specific $qty for more accurate taxes.
$product->get_price_suffix(); // Get the suffix to display after prices > 0.
$product->get_sale_price(); // Returns the product's sale price.
$product->get_regular_price(); // Returns the product's regular price.
$product->get_tax_class(); // Returns the tax class.
$product->get_tax_status(); // Returns the tax status.

/**
 *
 *  Image Related Data
 *
 */
$product->get_image(); // Returns the main product image.
$product->get_image_id(); // Get main image ID.
$product->get_gallery_attachment_ids(); // Returns the gallery attachment ids.
$product->get_gallery_image_ids(); // Returns the gallery attachment ids.

/**
 *
 *  Stock or Inventory Data
 *
 */
$product->get_backorders(); // Get backorders.
$product->get_availability(); // Returns the availability of the product.
$product->get_max_purchase_quantity(); // Get max quantity which can be purchased at once.
$product->get_min_purchase_quantity(); // Get min quantity which can be purchased at once.
$product->get_stock_managed_by_id(); // If the stock level comes from another product ID, this should be modified.
$product->get_stock_quantity(); // Returns number of items available for sale.
$product->get_stock_status(); // Return the stock status.
$product->get_total_stock(); // Get total stock - This is the stock of parent and children combined.
$product->get_sold_individually(); // Return if should be sold individually.
$product->get_low_stock_amount(); // Get low stock amount.

/**
 *
 *  Shipping Data
 *
 */
$product->get_height(); // Returns the product height.
$product->get_length(); // Returns the product length.
$product->get_weight(); // Returns the product's weight.
$product->get_width(); // Returns the product width.
$product->get_dimensions(); // Returns formatted dimensions.
$product->get_manage_stock(); // Return if product manage stock.
$product->get_shipping_class(); // Returns the product shipping class SLUG.
$product->get_shipping_class_id(); // Get shipping class ID.

/**
 *
 *  Product Variations / Parent Data
 *
 */
$product->get_child(); // Returns the child product.
$product->get_children(); // Returns the children IDs if applicable. Overridden by child classes.
$product->get_formatted_variation_attributes(); // Get formatted variation data with WC < 2.4 back compat and proper formatting of text-based attribute names.
$product->get_matching_variation(); // Match a variation to a given set of attributes using a WP_Query.
$product->get_parent(); // Get the parent of the post.
$product->get_parent_id(); // Get parent ID.
$product->get_variation_default_attributes(); // If set, get the default attributes for a variable product.
$product->get_variation_description(); // Get product variation description.
$product->get_variation_id(); // Get variation ID.

/**
 *
 *  Product Downloads
 *
 */
$product->get_download_expiry(); // Get download expiry.
$product->get_download_limit(); // Get download limit.
$product->get_downloadable(); // Get downloadable.
$product->get_downloads(); // Get downloads.
$product->get_file(); // Get a file by $download_id.
$product->get_file_download_path(); // Get file download path identified by $download_id.
$product->get_files(); // Same as $product->get_downloads in CRUD.

/**
 *
 *  Attributes, Tags, Categories & Associated Data Objects
 *
 */
$product->get_attribute(); // Returns a single product attribute as a string.
$product->get_attributes(); // Returns product attributes.
$product->get_categories(); // Returns the product categories.
$product->get_category_ids(); // Get category ids.
$product->get_default_attributes(); // Get default attributes.
$product->get_cross_sell_ids(); // Get cross sell IDs.
$product->get_cross_sells(); // Returns the cross sell product ids.
$product->get_related(); // Get and return related products.
$product->get_tag_ids(); // Get tag ids.
$product->get_tags(); // Returns the product tags.
$product->get_upsell_ids(); // Get upsell IDs.
$product->get_upsells(); // Returns the upsell product ids.
$product->get_meta(); // Get Meta Data by Key.
$product->get_meta_data(); // Get All Meta Data.

/**
 *
 *  Ratings and Reviews
 *
 */
$product->get_rating_count(); // Get the total amount (COUNT) of ratings, or just the count for one rating e.g. number of 5 star ratings.
$product->get_rating_counts(); // Get rating count.
$product->get_rating_html(); // Returns the product rating in html format.
$product->get_review_count(); // Get review count.
$product->get_reviews_allowed(); // Return if reviews is allowed.
$product->get_average_rating(); // Get average rating.

/**
 *
 *  Other Product Data
 *
 */
$product->get_changes(); // Return data changes only.
$product->get_data(); // Returns all data for this object.
$product->get_data_keys(); // Returns array of expected data keys for this object.
$product->get_data_store(); // Get the data store.
$product->get_date_created(); // Get product created date.
$product->get_date_modified(); // Get product modified date.
$product->get_extra_data_keys(); // Returns all "extra" data keys for an object (for sub objects like product types).
$product->get_menu_order(); // Get menu order.
$product->get_meta_cache_key(); // Helper method to compute meta cache key. Different from WP Meta cache key in that meta data cached using this key also contains meta_id column.
$product->get_object_read(); // Get object read property.
$product->get_post_data(); // Get the product's post data.
$product->get_post_password(); // Get post password.
$product->get_purchase_note(); // Get purchase note.</pre>
<h5>Responsive Webseite von Webdesigner erstellen lassen? <a href="https://homepage-nach-preis.de/homepage-erstellen-lassen-kosten/" Title="Responsive Website erstellen lassen"><font color="orange">WEBDESIGN ANGEBOTE ANSEHEN</font></a></h5>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2023/05/27/woocommerce-individuelles-badge-erstellen/">WooCommerce individuelles Badge erstellen</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/2023/05/27/woocommerce-individuelles-badge-erstellen/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Custom Felder bei WooCommerce Produkte</title>
		<link>https://homepage-nach-preis.de/2023/05/27/custom-felder-bei-woocommerce-produkte/</link>
					<comments>https://homepage-nach-preis.de/2023/05/27/custom-felder-bei-woocommerce-produkte/#respond</comments>
		
		<dc:creator><![CDATA[Homepage-nach-Preis]]></dc:creator>
		<pubDate>Sat, 27 May 2023 13:21:50 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Wordpress Code]]></category>
		<category><![CDATA[anzeigen]]></category>
		<category><![CDATA[Felder]]></category>
		<category><![CDATA[Informationen]]></category>
		<category><![CDATA[Produkt]]></category>
		<category><![CDATA[Shortcode]]></category>
		<category><![CDATA[Woocommerce]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=7673</guid>

					<description><![CDATA[<p>Individuelle WooCommerce Input &#038; Output Felder erzeugen Dieser Code erweitert die WooCommerce Produktseiten mit einem individuellen Eingabe-Text-Feld. Die eingegebenen Daten werden anschließend im Frontend der Produktseite ausgegeben. Der Code muss in die Functions.php, im Hauptverzeichnis des WordPress-Themes, eingefügt werden. Funktionsumfang: &#8211; Erzeugt ein Text-Input-Feld im Backend der WooCommerce Produkte (global, bei allen Produkten) &#8211; Speichert die Daten des Input-Feldes bei Aktualisierung des Produktes (Getrennte Daten für jedes Produkt) &#8211; Anzeige der gespeicherten Daten im Frontend des WooCommerce Produktes &#8212; Anzeige standardmäßig direkt über dem Warenkorb-Button /** * Custom Field / Info in a Woocommerce Product * @since 1.0.0 */ /** * Display the custom field on the front end of a Woocommerce product * @since 1.0.0 */ function hnp_display_custom_field_1() { global $post; // Check for the custom field value $product = wc_get_product($post-&#x3E;ID); $title = $product-&#x3E;get_meta(&#x27;hnp_custom_text_field_title_1&#x27;); if ($title) { // Only display our field if we&#x27;ve got a value for the field title printf(&#x27;%s&#x27;, esc_html($title)); } } add_action(&#x27;woocommerce_before_add_to_cart_button&#x27;, &#x27;hnp_display_custom_field_1&#x27;); /** * Create the custom text input field in the Backend of a Woocommerce Product * @since 1.0.0 */ function hnp_hnp_create_custom_field_1() { $args = array( &#x27;id&#x27; =&#x3E; &#x27;hnp_custom_text_field_title_1&#x27;, &#x27;label&#x27; =&#x3E; __(&#x27;Custom Field&#x27;, &#x27;hnp&#x27;) , &#x27;class&#x27; =&#x3E; &#x27;hnp-custom-field&#x27;, &#x27;desc_tip&#x27; =&#x3E; true, &#x27;description&#x27; =&#x3E;....</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2023/05/27/custom-felder-bei-woocommerce-produkte/">Custom Felder bei WooCommerce Produkte</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[<h3>Individuelle WooCommerce Input &#038; Output Felder erzeugen</h3>
<p>Dieser Code erweitert die WooCommerce Produktseiten mit einem individuellen Eingabe-Text-Feld. Die eingegebenen Daten werden anschließend im Frontend der Produktseite ausgegeben. Der Code muss in die Functions.php, im Hauptverzeichnis des WordPress-Themes, eingefügt werden. </p>
<p><strong>Funktionsumfang:</strong></p>
<p>&#8211; Erzeugt ein Text-Input-Feld im Backend der WooCommerce Produkte (global, bei allen Produkten)</p>
<p>&#8211; Speichert die Daten des Input-Feldes bei Aktualisierung des Produktes (Getrennte Daten für jedes Produkt)</p>
<p>&#8211; Anzeige der gespeicherten Daten im Frontend des WooCommerce Produktes<br />
&#8212; Anzeige standardmäßig direkt über dem Warenkorb-Button</p>
<pre>


/**
 * Custom Field / Info in a Woocommerce Product
 * @since 1.0.0
 */

/**
 * Display the custom field on the front end of a Woocommerce product
 * @since 1.0.0
 */

function hnp_display_custom_field_1()
{
    global $post;
    // Check for the custom field value
    $product = wc_get_product($post-&#x3E;ID);
    $title = $product-&#x3E;get_meta(&#x27;hnp_custom_text_field_title_1&#x27;);
    if ($title)
    {
        // Only display our field if we&#x27;ve got a value for the field title
        printf(&#x27;%s&#x27;, esc_html($title));
    }
}
add_action(&#x27;woocommerce_before_add_to_cart_button&#x27;, &#x27;hnp_display_custom_field_1&#x27;);

/**
 * Create the custom text input field in the Backend of a Woocommerce Product
 * @since 1.0.0
 */

function hnp_hnp_create_custom_field_1()
{
    $args = array(
        &#x27;id&#x27; =&#x3E; &#x27;hnp_custom_text_field_title_1&#x27;,
        &#x27;label&#x27; =&#x3E; __(&#x27;Custom Field&#x27;, &#x27;hnp&#x27;) ,
        &#x27;class&#x27; =&#x3E; &#x27;hnp-custom-field&#x27;,
        &#x27;desc_tip&#x27; =&#x3E; true,
        &#x27;description&#x27; =&#x3E; __(&#x27;Enter the title of your custom text field.&#x27;, &#x27;chnp&#x27;) ,
    );
    woocommerce_wp_text_input($args);
}
add_action(&#x27;woocommerce_product_options_general_product_data&#x27;, &#x27;hnp_hnp_create_custom_field_1&#x27;);

/**
 * Save the custom field
 * @since 1.0.0
 */
function hnp_save_custom_field_1($post_id)
{
    $product = wc_get_product($post_id);
    $title = isset($_POST[&#x27;hnp_custom_text_field_title_1&#x27;]) ? $_POST[&#x27;hnp_custom_text_field_title_1&#x27;] : &#x27;&#x27;;
    $product-&#x3E;update_meta_data(&#x27;hnp_custom_text_field_title_1&#x27;, sanitize_text_field($title));
    $product-&#x3E;save();
}
add_action(&#x27;woocommerce_process_product_meta&#x27;, &#x27;hnp_save_custom_field_1&#x27;);




</pre>
<p>Wenn im Backend keine Daten im Input-Feld eingetragen wurden, ist die Funktion und die Frontend-Ausgabe nicht aktiv. Somit kann entschieden werden, bei welchen Produkten die Funktion aktiviert und ausgegeben wird.<br />
Information: Es sollte mehr als ein Feld pro Produkt genutzt werden? Dazu muss lediglich die Zahl &#8220;1&#8221; im kompletten Code zu &#8220;2&#8221; geändert werden. Und der Code ein zweites Mal in die Funktions.php eingefügt werden. Der Code kann beliebig oft genutzt werden, sofern jeweils die Zahl pro Nutzung fortlaufend geändert wird.</p>
<p><strong>Erweiterung 1: </strong><br />
Sollte die Frontend-Anzeige noch mit einem Eingabefeld sein, wird Zeile 22: </p>
<pre>printf(&#x27;%s&#x27;, esc_html($title));</pre>
<p>mit diesem Code ausgetauscht: </p>
<pre>printf(&#x27;&#x3C;div class=&#x22;hnp-custom-field-wrapper&#x22;&#x3E;&#x3C;label for=&#x22;hnp-title-field&#x22;&#x3E;%s&#x3C;/label&#x3E;&#x3C;input type=&#x22;text&#x22; id=&#x22;hnp-title-field&#x22; name=&#x22;hnp-title-field&#x22; value=&#x22;&#x22;&#x3E;&#x3C;/div&#x3E;&#x27;, esc_html( $title ));</pre>
<p><strong>Individualisierung 1: </strong><br />
Sollte die Ausgabe des Inputs nicht über dem Warenkorb-Button sein, sondern an einer anderen Position, muss der WooCommerce Hook in Zeile 25</p>
<pre>add_action(&#x27;woocommerce_before_add_to_cart_button&#x27;, &#x27;hnp_display_custom_field_1&#x27;);</pre>
<p>ausgetauscht werden.</p>
<p><strong>Weitere Hooks / Platzierungen (von oben nach unten): </strong></p>
<p>Hook 1: Vor dem Content des Produktes: </p>
<pre>woocommerce_before_single_product</pre>
<p>Hook 2: Vor dem Content des Produktes 2: </p>
<pre>woocommerce_before_single_product_summary</pre>
<p>Hook 3: Nach dem Titel / der Produktüberschrift: </p>
<pre>woocommerce_single_product_summary</pre>
<p>Hook 5: Nach der Kurzbeschreibung:</p>
<pre>woocommerce_before_add_to_cart_form</pre>
<p>Hook 6: Vor den Variationen:</p>
<pre>woocommerce_before_variations_form</pre>
<p>Hook 7: Nach den Variationen:</p>
<pre>woocommerce_before_add_to_cart_button</pre>
<p>Hook 8: Nach den Variationen 2:</p>
<pre>woocommerce_before_single_variation</pre>
<p>Hook 9: Nach der Single Variation:</p>
<pre>woocommerce_single_variation</pre>
<p>Hook 10: Vor der Anzahl-Auswahl:</p>
<pre>woocommerce_before_add_to_cart_quantity</pre>
<p>Hook 11: Nach der Anzahl-Auswahl:</p>
<pre>woocommerce_after_add_to_cart_quantity</pre>
<p>Hook 12: Nach dem Warenkorb Button 1:</p>
<pre>woocommerce_after_single_variation</pre>
<p>Hook 13: Nach dem Warenkorb Button 2:</p>
<pre>woocommerce_after_add_to_cart_button</pre>
<p>Hook 14: Nach dem Warenkorb Button 3:</p>
<pre>woocommerce_after_variations_form</pre>
<p>Hook 15: Nach dem Warenkorb Button 4:</p>
<pre>woocommerce_after_add_to_cart_form</pre>
<p>Hook 16: Vor der Produkt Meta: </p>
<pre>woocommerce_product_meta_start</pre>
<p>Hook 17: Nach der Produkt Meta: </p>
<pre>woocommerce_product_meta_end</pre>
<p>Hook 18: Share / Teilen Area: </p>
<pre>woocommerce_share</pre>
<p>Hook 19: Unter den Produkt-Fotos: </p>
<pre>woocommerce_product_thumbnails</pre>
<p>Hook 20: Am Ende des Produktes: </p>
<pre>woocommerce_after_single_product_summary</pre>
<p>Je nach Theme kann es sein, dass nicht alle Hooks im Design integriert sind oder auch an anderen Positionen angezeigt werden. Durch Ausprobieren oder Auslesen des Theme-Codes sollte aber eine passende Position gefunden werden.</p>
<p><strong>Eigenen Hook erstellen: </strong><br />
Sollten die WooCommerce Standard-Hooks nicht die passende Position bereitstellen, muss ein individueller Hook erstellt werden.</p>
<p>Dazu wird die Zeile 25 auf einen individuellen Hook-Tag geändert:</p>
<pre>add_action(&#x27;hnp_custom_hook_1&#x27;, &#x27;hnp_display_custom_field_1&#x27;);</pre>
<p>Der Hook kann nun in einer gewünschten Stelle im Design eingebunden werden, durch diesen Code:</p>
<pre>&#x3C;?php do_action(&#x27;hnp_custom_hook_1&#x27;);?&#x3E;</pre>
<p>Falls der PhP Tag bereits offen ist: </p>
<pre>do_action(&#x27;hnp_custom_hook_1&#x27;);</pre>
<p><strong>Shortcode anstatt Hook nutzen</strong><br />
Sollte die Funktion nicht automatisch durch einen Hook eingebunden werden, sondern durch ein Shortcode, wird die &#8220;Add Action&#8221; Funktion aus Zeile 25 entfernt und zudem eine Shortcode-Funktion erstellt. Der fertige Code sieht folgend aus:</p>
<pre>
/**
 * Custom Field / Info in a Woocommerce Product
 * @since 1.0.0
 */

/**
 * Display the custom field on the front end of a Woocommerce product
 * @since 1.0.0
 */

function hnp_display_custom_field_1()
{
    global $post;
    // Check for the custom field value
    $product = wc_get_product($post-&#x3E;ID);
    $title = $product-&#x3E;get_meta(&#x27;hnp_custom_text_field_title_1&#x27;);
    if ($title)
    {
        // Only display our field if we&#x27;ve got a value for the field title
        printf(&#x27;%s&#x27;, esc_html($title));
    }
}

/**
 * Create the custom text input field in the Backend of a Woocommerce Product
 * @since 1.0.0
 */

function hnp_hnp_create_custom_field_1()
{
    $args = array(
        &#x27;id&#x27; =&#x3E; &#x27;hnp_custom_text_field_title_1&#x27;,
        &#x27;label&#x27; =&#x3E; __(&#x27;Custom Input&#x27;, &#x27;hnp&#x27;) ,
        &#x27;class&#x27; =&#x3E; &#x27;hnp-custom-field&#x27;,
        &#x27;desc_tip&#x27; =&#x3E; true,
        &#x27;description&#x27; =&#x3E; __(&#x27;Enter the title of your custom text field.&#x27;, &#x27;chnp&#x27;) ,
    );
    woocommerce_wp_text_input($args);
}
add_action(&#x27;woocommerce_product_options_general_product_data&#x27;, &#x27;hnp_hnp_create_custom_field_1&#x27;);

/**
 * Save the custom field
 * @since 1.0.0
 */
function hnp_save_custom_field_1($post_id)
{
    $product = wc_get_product($post_id);
    $title = isset($_POST[&#x27;hnp_custom_text_field_title_1&#x27;]) ? $_POST[&#x27;hnp_custom_text_field_title_1&#x27;] : &#x27;&#x27;;
    $product-&#x3E;update_meta_data(&#x27;hnp_custom_text_field_title_1&#x27;, sanitize_text_field($title));
    $product-&#x3E;save();
}
add_action(&#x27;woocommerce_process_product_meta&#x27;, &#x27;hnp_save_custom_field_1&#x27;);

/**
 * Custom Shortcode
 * @since 1.0.0
 */


function hnp_custom_short1(){
    return hnp_display_custom_field_1();
}

add_shortcode(&#x27;hnp_custom_shortcode_1&#x27;, &#x27;hnp_custom_short1&#x27;); 



</pre>
<p>Auch diese Funktion kann mehrfach genutzt werden, sofern die Zahl &#8220;1&#8221; aus dem kompletten Code ausgetauscht wird. Das Shortcode für die Frontend-Anzeige ist:</p>
<pre>[hnp_custom_shortcode_1]</pre>
<p>Das Shortcode kann in Widgets, Produktbeschreibungen, Texteditoren oder bei anderen Nutzungsmöglichkeiten (z.B. Pagebuildern) genutzt werden. Sollte das Shortcode in eine HTML-Datei eingefügt werden, wäre der passende Code: </p>
<pre>&#x3C;?php echo do_shortcode(&#x27;[hnp_custom_shortcode_1]&#x27;); ?&#x3E;</pre>
<p>Sollte das Shortcode in eine PHP Datei (mit geöffneten PHP Tag) eingebunden werden, wäre der Code: </p>
<pre>echo do_shortcode(&#x27;[hnp_custom_shortcode_1]&#x27;); </pre>
<p><strong>Weitere Möglichkeiten: </strong><br />
Es könnten auch Container, Bilder oder andere HTML Tags für das Frontend eingebunden werden, indem Zeile 25 erweitert wird:</p>
<pre>printf(&#x27;%s&#x27;, esc_html($title));</pre>
<p>Dieser Tag übergibt die eingetragenen Daten des Backends:</p>
<pre>%s</pre>
<p>Hierbei ein Code mit zusätzlich einem Bild und in einem Container: </p>
<pre>  printf(&#x27;&#x3C;div class=&#x22;hnp-container_1&#x22;&#x3E;&#x3C;h3&#x3E;&#xDC;berschrift:&#x3C;/h3&#x3E;&#x3C;p&#x3E;%s&#x3C;/p&#x3E;&#x3C;br&#x3E;&#x3C;img src=&#x22;www.url_zum_bild&#x22; alt=&#x22;alt_tag&#x22; /&#x3E;&#x3C;/div&#x3E;&#x27;, esc_html($title));</pre>
<p>Wenn der Input zusätzlich an die Warenkorbdaten übertragen werden sollen, wäre dies so möglich: </p>
<pre>

/**
 * Custom Field / Info in a Woocommerce Product
 * @since 1.0.0
 */

/**
 * Display the custom field on the front end of a Woocommerce product
 * @since 1.0.0
 */
function hnp_display_custom_field_1() {
    global $post;
    // Check for the custom field value
    $product = wc_get_product($post-&#x3E;ID);
    $title = $product-&#x3E;get_meta(&#x27;hnp_custom_text_field_title_1&#x27;);
    if ($title) {
        // Only display our field if we&#x27;ve got a value for the field title
        printf(&#x27;%s&#x27;, esc_html($title));
    }
}
add_action(&#x27;woocommerce_before_add_to_cart_button&#x27;, &#x27;hnp_display_custom_field_1&#x27;);

/**
 * Create the custom text input field in the Backend of a Woocommerce Product
 * @since 1.0.0
 */
function hnp_hnp_create_custom_field_1() {
    $args = array(
        &#x27;id&#x27; =&#x3E; &#x27;hnp_custom_text_field_title_1&#x27;,
        &#x27;label&#x27; =&#x3E; __(&#x27;Custom Field&#x27;, &#x27;hnp&#x27;),
        &#x27;class&#x27; =&#x3E; &#x27;hnp-custom-field&#x27;,
        &#x27;desc_tip&#x27; =&#x3E; true,
        &#x27;description&#x27; =&#x3E; __(&#x27;Enter the title of your custom text field.&#x27;, &#x27;hnp&#x27;),
    );
    woocommerce_wp_text_input($args);
}
add_action(&#x27;woocommerce_product_options_general_product_data&#x27;, &#x27;hnp_hnp_create_custom_field_1&#x27;);

/**
 * Save the custom field
 * @since 1.0.0
 */
function hnp_save_custom_field_1($post_id) {
    $product = wc_get_product($post_id);
    $title = isset($_POST[&#x27;hnp_custom_text_field_title_1&#x27;]) ? $_POST[&#x27;hnp_custom_text_field_title_1&#x27;] : &#x27;&#x27;;
    $product-&#x3E;update_meta_data(&#x27;hnp_custom_text_field_title_1&#x27;, sanitize_text_field($title));
    $product-&#x3E;save();
}
add_action(&#x27;woocommerce_process_product_meta&#x27;, &#x27;hnp_save_custom_field_1&#x27;);

/**
 * Add custom field value to cart item data
 * @since 1.0.0
 */
function hnp_add_custom_field_to_cart_item($cart_item_data, $product_id) {
    $product = wc_get_product($product_id);
    $custom_field_value = $product-&#x3E;get_meta(&#x27;hnp_custom_text_field_title_1&#x27;);

    if (!empty($custom_field_value)) {
        $cart_item_data[&#x27;hnp_custom_text_field_title_1&#x27;] = $custom_field_value;
    }

    return $cart_item_data;
}
add_filter(&#x27;woocommerce_add_cart_item_data&#x27;, &#x27;hnp_add_custom_field_to_cart_item&#x27;, 10, 2);

/**
 * Display custom field value in the cart
 * @since 1.0.0
 */
function hnp_display_custom_field_in_cart($item_data, $cart_item) {
    if (isset($cart_item[&#x27;hnp_custom_text_field_title_1&#x27;])) {
        $item_data[] = array(
            &#x27;name&#x27; =&#x3E; __(&#x27;Custom Field&#x27;, &#x27;hnp&#x27;),
            &#x27;value&#x27; =&#x3E; $cart_item[&#x27;hnp_custom_text_field_title_1&#x27;]
        );
    }

    return $item_data;
}
add_filter(&#x27;woocommerce_get_item_data&#x27;, &#x27;hnp_display_custom_field_in_cart&#x27;, 10, 2);

/**
 * Save custom field value in cart item meta
 * @since 1.0.0
 */
function hnp_save_custom_field_in_cart_item($item_id, $values, $cart_item_key) {
    if (isset($values[&#x27;hnp_custom_text_field_title_1&#x27;])) {
        wc_add_order_item_meta($item_id, &#x27;hnp_custom_text_field_title_1&#x27;, $values[&#x27;hnp_custom_text_field_title_1&#x27;]);
    }
}
add_action(&#x27;woocommerce_add_order_item_meta&#x27;, &#x27;hnp_save_custom_field_in_cart_item&#x27;, 10, 3);

/**
 * Display custom field value in order items
 * @since 1.0.0
 */
function hnp_display_custom_field_in_order_items($item_id, $item, $order) {
    if ($meta_value = wc_get_order_item_meta($item_id, &#x27;hnp_custom_text_field_title_1&#x27;, true)) {
        echo &#x27;&#x3C;p&#x3E;&#x3C;strong&#x3E;&#x27; . __(&#x27;Custom Field:&#x27;, &#x27;hnp&#x27;) . &#x27;&#x3C;/strong&#x3E; &#x27; . esc_html($meta_value) . &#x27;&#x3C;/p&#x3E;&#x27;;
    }
}
add_action(&#x27;woocommerce_order_item_meta_end&#x27;, &#x27;hnp_display_custom_field_in_order_items&#x27;, 10, 3);


</pre>
<p>Zu beachten ist, dass das Backend-Feld nur mit Text (ohne Code) gefüllt werden sollte, ansonsten könnten Fehler erzeugt werden. Deswegen sollten HTML-Codes ausschließlich über die HTML / PHP Dateien eingebunden werden.<br />
</p>
<h5>Sie wurden gehackt oder Ihre Webseiten mit Viren/Malware infiziert? Wir säubern und schützen Ihre Webseite: <a  href="https://homepage-nach-preis.de/webseite-gehackt-viren-reinigung/" title="Webseite gehackt? Antivirus Service"> <span style="color:#efaa15;">→ Webseiten-Anti-Virus-Service</span></a></h5>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2023/05/27/custom-felder-bei-woocommerce-produkte/">Custom Felder bei WooCommerce Produkte</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/2023/05/27/custom-felder-bei-woocommerce-produkte/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>WordPress Shortcodes einbinden</title>
		<link>https://homepage-nach-preis.de/2020/05/08/wordpress-shortcodes-einbinden/</link>
					<comments>https://homepage-nach-preis.de/2020/05/08/wordpress-shortcodes-einbinden/#respond</comments>
		
		<dc:creator><![CDATA[Christopher Rohde]]></dc:creator>
		<pubDate>Fri, 08 May 2020 07:46:31 +0000</pubDate>
				<category><![CDATA[Allgemein]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[Befehl]]></category>
		<category><![CDATA[Echo]]></category>
		<category><![CDATA[einbinden]]></category>
		<category><![CDATA[Footer]]></category>
		<category><![CDATA[Header]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Shortcode]]></category>
		<guid isPermaLink="false">https://homepage-nach-preis.de/?p=4534</guid>

					<description><![CDATA[<p>Oftmals werden Shortcodes in der Footer.php, Function.php, Header.php oder sonstigen PHP-Dateien nicht genutzt und wie eingegeben auch wieder ausgegeben. Mit diesem PHP-Code werden die Shortcodes als Befehl angesehen und funktionieren auch bei einer direkten Eintragung in den PHP-Dateien: &#160; &#60;?php echo do_shortcode('[SHORTCODE]'); ?&#62; Sie müssen lediglich anstatt &#8220;[SHORTCODE]&#8221; Ihr Shortcode eingeben und den vollen Befehl anschließend in die passende Datei einfügen. Nun wird das Shortcode auch korrekt genutzt. &#160; Möchten Sie einen Webdesigner-Onlineshop erstellen lassen? FESTPREIS ANGEBOTE</p>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2020/05/08/wordpress-shortcodes-einbinden/">WordPress Shortcodes 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/christopher-rohde/">Christopher Rohde</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Oftmals werden Shortcodes in der Footer.php, Function.php, Header.php oder sonstigen PHP-Dateien nicht genutzt und wie eingegeben auch wieder ausgegeben.<br />
Mit diesem PHP-Code werden die Shortcodes als Befehl angesehen und funktionieren auch bei einer direkten Eintragung in den PHP-Dateien:</p>
<p>&nbsp;</p>
<pre>&lt;?php echo do_shortcode('[SHORTCODE]'); ?&gt;
</pre>
<p>Sie müssen lediglich anstatt &#8220;[SHORTCODE]&#8221; Ihr Shortcode eingeben und den vollen Befehl anschließend in die passende Datei einfügen. Nun wird das Shortcode auch korrekt genutzt.</p>
<p>&nbsp;</p>
<h5>Möchten Sie einen Webdesigner-Onlineshop erstellen lassen? <a title="Webdesigner Onlineshop Angebot" href="https://homepage-nach-preis.de/onlineshop-erstellen-lassen-kosten/"><span style="color: orange;">FESTPREIS ANGEBOTE</span></a></h5>
<p>Der Beitrag <a rel="nofollow" href="https://homepage-nach-preis.de/2020/05/08/wordpress-shortcodes-einbinden/">WordPress Shortcodes 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/christopher-rohde/">Christopher Rohde</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://homepage-nach-preis.de/2020/05/08/wordpress-shortcodes-einbinden/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
