<?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>PHP Archives - Tino-Designs.com</title>
	<atom:link href="https://www.tino-designs.com/en/category/php/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.tino-designs.com/en/category/php/</link>
	<description>Webdesign, Webentwicklung, Medien und Kreativität</description>
	<lastbuilddate>Thu, 04 Apr 2024 19:40:20 +0000</lastbuilddate>
	<language>en-US</language>
	<sy:updateperiod>
	hourly	</sy:updateperiod>
	<sy:updatefrequency>
	1	</sy:updatefrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.tino-designs.com/wp-content/uploads/2022/12/favicon_350px.png</url>
	<title>PHP Archives - Tino-Designs.com</title>
	<link>https://www.tino-designs.com/en/category/php/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Stop WordPress From Storing The IP Address For Comments</title>
		<link>https://www.tino-designs.com/en/wordpress-davon-abhhalten-die-ip-adresse-bei-kommentaren-zu-speichern/</link>
					<comments>https://www.tino-designs.com/en/wordpress-davon-abhhalten-die-ip-adresse-bei-kommentaren-zu-speichern/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubdate>Thu, 04 Apr 2024 19:11:20 +0000</pubdate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Datenschutz]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid ispermalink="false">https://www.tino-designs.com/?p=2381</guid>

					<description><![CDATA[<p>Aufgrund der DSGVO und Datenschutzbestimmungen in der EU, ist es ohne aktive Opt-In Zustimmung des Nutzers&#8230;</p>
<p>The post <a href="https://www.tino-designs.com/en/wordpress-davon-abhhalten-die-ip-adresse-bei-kommentaren-zu-speichern/">WordPress davon abhhalten die IP Adresse bei Kommentaren zu speichern</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Due to the GDPR and data protection regulations in the EU, it is not permitted to store the user's personal data without the user's active opt-in consent. This also includes the IP address. If you want to avoid the IP address notice, you can avoid saving the IP address at all.<br><br>The easiest way to do this is to add a small bit of PHP code into the WP theme's functions.php. </p>



<p>The following code ensures that WP no longer stores the IP address for comments:</p>



<pre class="wp-block-code"><code>&lt;?php 
function wp_no_comments_ip( $comment_author_ip ) { return ''; } add_filter( 'pre_comment_user_ip', 'wp_no_comments_ip' );
?></code></pre><p>The post <a href="https://www.tino-designs.com/en/wordpress-davon-abhhalten-die-ip-adresse-bei-kommentaren-zu-speichern/">WordPress davon abhhalten die IP Adresse bei Kommentaren zu speichern</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentrss>https://www.tino-designs.com/en/wordpress-davon-abhhalten-die-ip-adresse-bei-kommentaren-zu-speichern/feed/</wfw:commentrss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Privacy Poliy Checkbox For Wordpress Comments And Woocommerce Reviews</title>
		<link>https://www.tino-designs.com/en/datenschutz-checkbox-fuer-wordpress-kommentare-und-woocommerce-reviews/</link>
					<comments>https://www.tino-designs.com/en/datenschutz-checkbox-fuer-wordpress-kommentare-und-woocommerce-reviews/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubdate>Thu, 04 Jan 2024 19:36:00 +0000</pubdate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Datenschutz]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid ispermalink="false">https://www.tino-designs.com/?p=2377</guid>

					<description><![CDATA[<p>Um in der EU eine datenschutzkonforme Kommentarfunktion auf Wordpress zu bekommen muss einiges beachtet werden. Vor&#8230;</p>
<p>The post <a href="https://www.tino-designs.com/en/datenschutz-checkbox-fuer-wordpress-kommentare-und-woocommerce-reviews/">Datenschutz Checkbox für Wordpress Kommentare und Woocommerce Reviews</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In order to have a privacy policy compliant comment function on Wordpress in the EU, a number of things must be taken into account. Above all, the user's consent is required to process user data. Such an opt-in checkbox can be implemented with the following code in the functions.php file of the WP theme used:</p>



<pre class="wp-block-code"><code>// F&uuml;gt die Funktion dem Standard WP Kommentar sowie dem Woocommerce Review Formular hinzu
function add_privacy_field_on_comment_form() {
   $req  = get_option( 'require_name_email' );
	$aria_req = ( $req ? &quot; aria-required='true'&quot; : '' );
        echo '&lt;div class=&quot;comment-form-datenschutz&quot;&gt;&lt;input id=&quot;datenschutz&quot; class=&quot;my-class&quot; name=&quot;datenschutz&quot; type=&quot;checkbox&quot;' . $aria_req /&gt;' .
	'&lt;label class=&quot;my-class&quot; for=&quot;datenschutz&quot;&gt;' . __( 'Mit der Nutzung dieses Formulars erkl&auml;ren Sie sich mit der Speicherung und Verarbeitung Ihrer Daten durch diese Website einverstanden. Des weiteren geben Sie uns die Einwilligung zur Ver&ouml;ffentlichung Ihres Kommentars und akzeptieren unsere &lt;a target=&quot;_blank&quot; href=&quot;https://www.tino-designs.com/en/datenschutz/&quot;&gt;Datenschutzerkl&auml;rung.&lt;/a&gt;' ) . ( $req ? ' &lt;span class=&quot;required&quot;&gt;*&lt;/span&gt;' : '' ) . '&lt;/label&gt;&lt;/div&gt;';
    }
    add_action( 'comment_form_logged_in_after', 'add_privacy_field_on_comment_form' );
    add_action( 'comment_form_after_fields', 'add_privacy_field_on_comment_form' );


//Pr&uuml;ft ob die Checkbock f&uuml;r den Datenschutz ausgew&auml;hlt wurde 
add_filter( 'preprocess_comment', 'webshaped_verify_comment_meta_data' );
function webshaped_verify_comment_meta_data( $commentdata ) {
	// Wenn die Checkbox leer ist und ein Gastnutzer schreiben m&ouml;chte...
	if ( empty( $_POST['datenschutz'] ) ) {
		// ... zeige folgenden Fehlertext an
		wp_die( __( '&lt;strong&gt;FEHLER&lt;/strong&gt;: Die Datenschutzbox wurde nicht akzeptiert.&lt;br&gt;&lt;br&gt;&lt;a href=&quot;javascript:history.back()&quot;&gt;&laquo; Zur&uuml;ck&lt;/a&gt;' ) );
	}
	return $commentdata;
}</code></pre><p>The post <a href="https://www.tino-designs.com/en/datenschutz-checkbox-fuer-wordpress-kommentare-und-woocommerce-reviews/">Datenschutz Checkbox für Wordpress Kommentare und Woocommerce Reviews</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentrss>https://www.tino-designs.com/en/datenschutz-checkbox-fuer-wordpress-kommentare-und-woocommerce-reviews/feed/</wfw:commentrss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to stop lazy loading the first image on every Wordpress post</title>
		<link>https://www.tino-designs.com/en/wie-man-lazy-loading-beim-ersten-bild-von-jedem-wordpress-beitrag-deaktiviert/</link>
					<comments>https://www.tino-designs.com/en/wie-man-lazy-loading-beim-ersten-bild-von-jedem-wordpress-beitrag-deaktiviert/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubdate>Wed, 05 Apr 2023 09:08:01 +0000</pubdate>
				<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid ispermalink="false">https://www.tino-designs.com/?p=2328</guid>

					<description><![CDATA[<p>Die Optimierung Ihrer Website für Besucher sowie für Google und andere Suchmaschinen sind wichtige Aufgaben, wenn&#8230;</p>
<p>The post <a href="https://www.tino-designs.com/en/wie-man-lazy-loading-beim-ersten-bild-von-jedem-wordpress-beitrag-deaktiviert/">Wie man Lazy Loading beim ersten Bild von jedem Wordpress Beitrag deaktiviert</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Optimizing your site for your visitors as well as Google and other search engones are important tasks, if you are serious about your interent presentation.</p>



<p>Google offers the Google Search Console to point out specific metrics that Google believes, should be improved. One of those metrics that come up a lot is called LCP. <a href="https://web.dev/lcp/" target="_blank" rel="noreferrer noopener">The largest contentful paint.</a>. </p>



<p>LCP-Metriken messen die Renderzeit des größten Bild- oder Textblocks, der im Darstellungsbereich sichtbar ist. Also im Grunde das größte Element &#8222;above the fold&#8220;. Das ist ziemlich oft ein Bild, besonders bei Blogposts oder anderen inhaltsreichen Seiten.</p>



<p>The issue here is, that wordpress started to lazy load all images of the site in Wordpress 5.4. It is a standard function, which is a great improvement. However in this case it would be better that the first image of the content would not be loaded using lazy load. Espescially if your site displays it abover the content and therefor above the fold.</p>



<p>The reason for this is that images being lazy loaded, are loading quite a bit slower. Therefor the LCP score often is a lot worse than it could. Google's <a href="/en/Pagespeed Insights/" target="_blank" rel="noreferrer noopener">Pagespeed Insights</a> actually suggests not to load the LCP using lazy loading quite often.</p>



<p>Since I had this issue before for several clients I cam up with a simple code hat can be pasted into the functions.php of your Wordpress theme.</p>



<pre class="wp-block-code"><code>//function to get first image in post content area
function get_first_image() {
    global $post, $posts;
    $first_img = '';
    ob_start();
    ob_end_clean();
    $output = preg_match_all('/&lt;img&#91;^&gt;]*src="(&#91;^"]+)"/i', $post-&gt;post_content, $matches);
    $first_img = $matches &#91;1] &#91;0];

   //defines a default image if no image was found
    if(empty($first_img)){ 
        $first_img = "/images/default.jpg";
    }
    return $first_img;
}

// disable lazy loading for first image inside post content
function no_lazy_load_on_first_image( $value, $image, $context ) {
if ( 'the_content' === $context ) {

//uses above function to check if image is the first image of the content area
$image_url = get_first_image();

if ( false !== strpos( $image, '' . $image_url . '' )) {
return false;
}
}
return $value;
}
add_filter( 'wp_img_tag_add_loading_attr', 'no_lazy_load_on_first_image', 10, 3);</code></pre>



<p>Dieser Code verwendet tatsächlich zwei Funktionen und den WP-Filter &#8222;wp_img_tag_add_loading_attr&#8220;. Mit diesem Filter können wir ändern, wie Lazy Loading hinzugefügt wird.</p>



<p>The first function finds the first image within the current post content. The second function simply checks if this is the image the filter is currently passing through. If so, false is returned instead of the regular value.</p>



<p>Feel free to improve, correct and comment on the code snippet below.</p><p>The post <a href="https://www.tino-designs.com/en/wie-man-lazy-loading-beim-ersten-bild-von-jedem-wordpress-beitrag-deaktiviert/">Wie man Lazy Loading beim ersten Bild von jedem Wordpress Beitrag deaktiviert</a> appeared first on <a href="https://www.tino-designs.com/en">Tino-Designs.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentrss>https://www.tino-designs.com/en/wie-man-lazy-loading-beim-ersten-bild-von-jedem-wordpress-beitrag-deaktiviert/feed/</wfw:commentrss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>