<?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>Code Archives - Nick Shaw</title>
	<atom:link href="https://www.nick-shaw.co.uk/category/code/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.nick-shaw.co.uk/category/code/</link>
	<description></description>
	<lastBuildDate>Fri, 10 Jul 2026 13:52:52 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
<site xmlns="com-wordpress:feed-additions:1">150481139</site>	<item>
		<title>Modify the plugin ‘Motors – Car Dealer, Classifieds &#038; Listing’ and limit the number of cars shown via the shortcode</title>
		<link>https://www.nick-shaw.co.uk/modify-the-plugin-motors-car-dealer-classifieds-listing-and-limit-the-number-of-cars-shown-via-the-shortcode/</link>
					<comments>https://www.nick-shaw.co.uk/modify-the-plugin-motors-car-dealer-classifieds-listing-and-limit-the-number-of-cars-shown-via-the-shortcode/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Fri, 10 Jul 2026 13:52:52 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2262</guid>

					<description><![CDATA[<p>Create this file in your child theme: Copy the original file from the plugin: Then change this line: to this: Then your shortcode can become: That will show 3 cars, in 3 columns.</p>
<p>The post <a href="https://www.nick-shaw.co.uk/modify-the-plugin-motors-car-dealer-classifieds-listing-and-limit-the-number-of-cars-shown-via-the-shortcode/">Modify the plugin ‘Motors – Car Dealer, Classifieds &#038; Listing’ and limit the number of cars shown via the shortcode</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Create this file in your child theme:</p>
<pre class="brush: php; title: ; notranslate">
/wp-content/themes/YOUR-CHILD-THEME/listings/shortcodes/motors-listings-tabs.php
</pre>
<p>Copy the original file from the plugin:</p>
<pre class="brush: php; title: ; notranslate">
motors-car-dealership-classified-listings/templates/shortcodes/motors-listings-tabs.php
</pre>
<p>Then change this line:</p>
<pre class="brush: php; title: ; notranslate">
$per_page = 8;
</pre>
<p>to this:</p>
<pre class="brush: php; title: ; notranslate">
$per_page = ! empty( $limit ) ? intval( $limit ) : 8;
</pre>
<p>Then your shortcode can become:</p>
<pre class="brush: php; title: ; notranslate">
&#x5B;motors_listings_tabs title=&#039;New/Used Cars&#039; columns=&#039;3&#039; recent_tab=&#039;yes&#039; limit=&#039;3&#039;]
</pre>
<p>That will show 3 cars, in 3 columns.</p>
<p>The post <a href="https://www.nick-shaw.co.uk/modify-the-plugin-motors-car-dealer-classifieds-listing-and-limit-the-number-of-cars-shown-via-the-shortcode/">Modify the plugin ‘Motors – Car Dealer, Classifieds &#038; Listing’ and limit the number of cars shown via the shortcode</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/modify-the-plugin-motors-car-dealer-classifieds-listing-and-limit-the-number-of-cars-shown-via-the-shortcode/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2262</post-id>	</item>
		<item>
		<title>Create sold page for the plugin &#8216;Motors – Car Dealer, Classifieds &#038; Listing&#8217; using Divi</title>
		<link>https://www.nick-shaw.co.uk/create-sold-page-for-the-plugin-motors-car-dealer-classifieds-listing-using-divi/</link>
					<comments>https://www.nick-shaw.co.uk/create-sold-page-for-the-plugin-motors-car-dealer-classifieds-listing-using-divi/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Tue, 23 Jun 2026 13:52:56 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2257</guid>

					<description><![CDATA[<p>Add this to the functions.php file add_shortcode(&#039;sold_cars&#039;, function ($atts) { $atts = shortcode_atts(&#x5B; &#039;posts_per_page&#039; =&#62; 12, ], $atts); $paged = max(1, get_query_var(&#039;paged&#039;) ?: get_query_var(&#039;page&#039;)); $query = new WP_Query(&#x5B; &#039;post_type&#039; =&#62; &#039;listings&#039;, &#039;post_status&#039; =&#62; &#039;publish&#039;, &#039;posts_per_page&#039; =&#62; intval($atts&#x5B;&#039;posts_per_page&#039;]), &#039;paged&#039; =&#62; $paged, &#039;meta_query&#039; =&#62; &#x5B; &#x5B; &#039;key&#039; =&#62; &#039;car_mark_as_sold&#039;, &#039;value&#039; =&#62; &#039;on&#039;, &#039;compare&#039; =&#62; &#039;=&#039;, ], ], [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/create-sold-page-for-the-plugin-motors-car-dealer-classifieds-listing-using-divi/">Create sold page for the plugin &#8216;Motors – Car Dealer, Classifieds &#038; Listing&#8217; using Divi</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to the functions.php file</p>
<pre class="brush: php; title: ; notranslate">
add_shortcode(&#039;sold_cars&#039;, function ($atts) {
    $atts = shortcode_atts(&#x5B;
        &#039;posts_per_page&#039; =&gt; 12,
    ], $atts);

    $paged = max(1, get_query_var(&#039;paged&#039;) ?: get_query_var(&#039;page&#039;));

    $query = new WP_Query(&#x5B;
        &#039;post_type&#039;      =&gt; &#039;listings&#039;,
        &#039;post_status&#039;    =&gt; &#039;publish&#039;,
        &#039;posts_per_page&#039; =&gt; intval($atts&#x5B;&#039;posts_per_page&#039;]),
        &#039;paged&#039;          =&gt; $paged,
        &#039;meta_query&#039;     =&gt; &#x5B;
            &#x5B;
                &#039;key&#039;     =&gt; &#039;car_mark_as_sold&#039;,
                &#039;value&#039;   =&gt; &#039;on&#039;,
                &#039;compare&#039; =&gt; &#039;=&#039;,
            ],
        ],
    ]);

    ob_start();

    if ($query-&gt;have_posts()) {
        echo &#039;&lt;div class=&quot;sold-cars-grid&quot;&gt;&#039;;

        while ($query-&gt;have_posts()) {
            $query-&gt;the_post();

            echo &#039;&lt;div class=&quot;sold-car-card&quot;&gt;&#039;;
            
            if (has_post_thumbnail()) {
                echo &#039;&lt;a href=&quot;&#039; . esc_url(get_permalink()) . &#039;&quot;&gt;&#039;;
                the_post_thumbnail(&#039;medium_large&#039;);
                echo &#039;&lt;/a&gt;&#039;;
            }

            echo &#039;&lt;span class=&quot;sold-badge&quot;&gt;Sold&lt;/span&gt;&#039;;
            echo &#039;&lt;h3&gt;&lt;a href=&quot;&#039; . esc_url(get_permalink()) . &#039;&quot;&gt;&#039; . esc_html(get_the_title()) . &#039;&lt;/a&gt;&lt;/h3&gt;&#039;;

           $price = get_post_meta(get_the_ID(), &#039;price&#039;, true);

			if ($price !== &#039;&#039; &amp;&amp; $price !== null) {
				if ((float) $price &lt; 0) {
					echo &#039;&lt;p class=&quot;sold-car-price&quot;&gt;POA&lt;/p&gt;&#039;;
				} else {
					echo &#039;&lt;p class=&quot;sold-car-price&quot;&gt;£&#039; . esc_html(number_format((float) $price)) . &#039;&lt;/p&gt;&#039;;
				}
			}

            echo &#039;&lt;/div&gt;&#039;;
        }

        echo &#039;&lt;/div&gt;&#039;;

        echo &#039;&lt;div class=&quot;sold-cars-pagination&quot;&gt;&#039;;
        echo paginate_links(&#x5B;
            &#039;total&#039;   =&gt; $query-&gt;max_num_pages,
            &#039;current&#039; =&gt; $paged,
        ]);
        echo &#039;&lt;/div&gt;&#039;;
    } else {
        echo &#039;&lt;p&gt;No sold cars found.&lt;/p&gt;&#039;;
    }

    wp_reset_postdata();

    return ob_get_clean();
});
</pre>
<p>Add this CSS to the stlyesheet</p>
<pre class="brush: css; title: ; notranslate">
.sold-cars-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 28px;
}

.sold-car-card {
    position: relative;
    background: #fff;
    border: 1px solid #e5e5e5;
    padding: 16px;
}

.sold-car-card img {
    width: 100%;
    height: auto;
    display: block;
}

.sold-car-card h3 {
    font-size: 20px;
    margin: 16px 0 8px;
}

.sold-badge {
    position: absolute;
    top: 24px;
    left: 24px;
    background: #c00;
    color: #fff;
    padding: 6px 12px;
    font-weight: 700;
    text-transform: uppercase;
    font-size: 13px;
}

.sold-car-price {
    font-weight: 700;
}

.sold-cars-pagination {
    margin-top: 32px;
    text-align: center;
}

@media (max-width: 980px) {
    .sold-cars-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 600px) {
    .sold-cars-grid {
        grid-template-columns: 1fr;
    }
}
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/create-sold-page-for-the-plugin-motors-car-dealer-classifieds-listing-using-divi/">Create sold page for the plugin &#8216;Motors – Car Dealer, Classifieds &#038; Listing&#8217; using Divi</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/create-sold-page-for-the-plugin-motors-car-dealer-classifieds-listing-using-divi/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2257</post-id>	</item>
		<item>
		<title>Show users how much they need to spend to qualify for Klarna on a WooCommerce site</title>
		<link>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-klarna-on-a-woocommerce-site/</link>
					<comments>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-klarna-on-a-woocommerce-site/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Thu, 06 Feb 2025 10:27:07 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[woocommerce]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2228</guid>

					<description><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [dividebyklarna] to get it to show up. function wpb_nick_klarna() { global $product; $klarnaprice = get_post_meta( get_the_ID(), '_regular_price', true); $klarnasaleprice = get_post_meta( get_the_ID(), '_sale_price', true); $y = $klarnaprice; $x = $klarnasaleprice; $number = ($y) / 3; $rounded = round($number,2); if ( $product-&#62;is_type( 'simple' ) [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-klarna-on-a-woocommerce-site/">Show users how much they need to spend to qualify for Klarna on a WooCommerce site</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [dividebyklarna] to get it to show up.</p>
<pre class="brush: php; title: ; notranslate">
function wpb_nick_klarna() {  
	global $product;
	$klarnaprice = get_post_meta( get_the_ID(), '_regular_price', true);
	$klarnasaleprice = get_post_meta( get_the_ID(), '_sale_price', true);		
		$y = $klarnaprice;
		$x = $klarnasaleprice;	
		$number = ($y) / 3;
		$rounded = round($number,2);
		
	
if ( $product-&gt;is_type( 'simple' ) ) {	
	if($klarnaprice &gt;=35 &amp;&amp; $klarnaprice &lt;=2000000 ) {		
		if(empty($klarnasaleprice)){			
		   $message = '&lt;div class=&quot;makepaymentsblock klarnablock&quot;&gt;Make 3 payments of '
		   .$message = '£'.$rounded  	
		   .$message = ' using &lt;strong&gt;Klarna&lt;/strong&gt; with no fees and 0% interest. &lt;a class=&quot;sg-popup-id-24192&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';					
		} else {
		   $numbersale = ($x) / 3;	
		   $roundedsale = round($numbersale,2);	
		   $message = '&lt;div class=&quot;makepaymentsblock klarnablock&quot;&gt;Make 3 payments of '
		   .$message = '£'.$roundedsale  	
		   .$message = ' using &lt;strong&gt;Klarna&lt;/strong&gt; with no fees and 0% interest. &lt;a class=&quot;sg-popup-id-24192&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';			
		}		 
	} else {
		if(empty($klarnasaleprice)){		
        	$message = '&lt;div class=&quot;makepaymentsblock klarnablock&quot;&gt;The minimum amount for Klarna is £35 &lt;br/&gt;&lt;a class=&quot;sg-popup-id-24192&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';
		} else {
		    $numbersale = ($x) / 3;	
		    $roundedsale = round($numbersale,2);	
			$message = '&lt;div class=&quot;makepaymentsblock klarnablock&quot;&gt;The minimum amount for Klarna is £35 &lt;br/&gt;&lt;a class=&quot;sg-popup-id-24192&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';
		}
	}
// Output needs to be return
return $message;
}
} 
// register shortcode
add_shortcode('dividebyklarna', 'wpb_nick_klarna'); 
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-klarna-on-a-woocommerce-site/">Show users how much they need to spend to qualify for Klarna on a WooCommerce site</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-klarna-on-a-woocommerce-site/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2228</post-id>	</item>
		<item>
		<title>Show users how much they need to spend to qualify for PayPal on a WooCommerce site</title>
		<link>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-paypal-on-a-woocommerce-site/</link>
					<comments>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-paypal-on-a-woocommerce-site/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Thu, 06 Feb 2025 09:59:59 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[woocommerce]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2230</guid>

					<description><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [dividebypaypal] to get it to show up. // function that runs when shortcode is called function wpb_nick_paypal() { global $product; $paypalprice = get_post_meta( get_the_ID(), '_regular_price', true); $paypalsaleprice = get_post_meta( get_the_ID(), '_sale_price', true); $y = $paypalprice; $x = $paypalsaleprice; $number = ($y) / 4; [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-paypal-on-a-woocommerce-site/">Show users how much they need to spend to qualify for PayPal on a WooCommerce site</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [dividebypaypal] to get it to show up.</p>
<pre class="brush: php; title: ; notranslate">
// function that runs when shortcode is called
function wpb_nick_paypal() {  
	global $product;
	$paypalprice = get_post_meta( get_the_ID(), '_regular_price', true);
	$paypalsaleprice = get_post_meta( get_the_ID(), '_sale_price', true);	
		$y = $paypalprice;
		$x = $paypalsaleprice;
		$number = ($y) / 4;
		$rounded = round($number,2);

if ( $product-&gt;is_type( 'simple' ) ) {	
	if($paypalprice &gt;=99 &amp;&amp; $paypalprice &lt;=2000000 ) {
		if(empty($paypalsaleprice)){
			$message = '&lt;div class=&quot;makepaymentsblock paypalblock&quot;&gt;Make 4 payments of '
	   		.$message = '£'.$rounded  		   
	   		.$message = ' using &lt;strong&gt;PayPal Credit&lt;/strong&gt; with no fees and 0% interest. &lt;a class=&quot;sg-popup-id-24194&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';
		} else {
		    $numbersale = ($x) / 4;	
		    $roundedsale = round($numbersale,2);	
			$message = '&lt;div class=&quot;makepaymentsblock paypalblock&quot;&gt;Make 4 payments of '
	   		.$message = '£'.$roundedsale  		   
	   		.$message = ' using &lt;strong&gt;PayPal Credit&lt;/strong&gt; with no fees and 0% interest. &lt;a class=&quot;sg-popup-id-24194&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';
		}			
	} else {			
		if(empty($paypalsaleprice)){
			$message = '&lt;div class=&quot;makepaymentsblock paypalblock&quot;&gt;The minimum amount for PayPal Credit is £99 &lt;br/&gt;&lt;a class=&quot;sg-popup-id-24194&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';
		 } else {
		    $numbersale = ($x) / 4;	
		    $roundedsale = round($numbersale,2);	
			$message = '&lt;div class=&quot;makepaymentsblock paypalblock&quot;&gt;The minimum amount for PayPal Credit is £99 &lt;br/&gt;&lt;a class=&quot;sg-popup-id-24194&quot; href=&quot;&quot;&gt;Read More&lt;/a&gt;&lt;/div&gt;';		
		 }		
	}
	
// Output needs to be return
return $message;
}
} 
// register shortcode
add_shortcode('dividebypaypal', 'wpb_nick_paypal'); 
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-paypal-on-a-woocommerce-site/">Show users how much they need to spend to qualify for PayPal on a WooCommerce site</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/show-users-how-much-they-need-to-spend-to-qualify-for-paypal-on-a-woocommerce-site/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2230</post-id>	</item>
		<item>
		<title>Function to disable comments in WordPress</title>
		<link>https://www.nick-shaw.co.uk/function-to-disable-comments-in-wordpress/</link>
					<comments>https://www.nick-shaw.co.uk/function-to-disable-comments-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Tue, 23 Jan 2024 09:52:24 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2238</guid>

					<description><![CDATA[<p>// Disable comments on all post types function df_disable_comments_post_types_support() { $post_types = get_post_types(); foreach ($post_types as $post_type) { if(post_type_supports($post_type, 'comments')) { remove_post_type_support($post_type, 'comments'); remove_post_type_support($post_type, 'trackbacks'); } } } add_action('admin_init', 'df_disable_comments_post_types_support'); // Close comments on the front-end function df_disable_comments_status() { return false; } add_filter('comments_open', 'df_disable_comments_status', 20, 2); add_filter('pings_open', 'df_disable_comments_status', 20, 2); // Hide existing comments function [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/function-to-disable-comments-in-wordpress/">Function to disable comments in WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
// Disable comments on all post types
function df_disable_comments_post_types_support() {
	$post_types = get_post_types();
	foreach ($post_types as $post_type) {
		if(post_type_supports($post_type, 'comments')) {
			remove_post_type_support($post_type, 'comments');
			remove_post_type_support($post_type, 'trackbacks');
		}
	}
}
add_action('admin_init', 'df_disable_comments_post_types_support');

// Close comments on the front-end
function df_disable_comments_status() {
	return false;
}
add_filter('comments_open', 'df_disable_comments_status', 20, 2);
add_filter('pings_open', 'df_disable_comments_status', 20, 2);

// Hide existing comments
function df_disable_comments_hide_existing_comments($comments) {
	$comments = array();
	return $comments;
}
add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);

// Remove comments page in menu
function df_disable_comments_admin_menu() {
	remove_menu_page('edit-comments.php');
}
add_action('admin_menu', 'df_disable_comments_admin_menu');

// Redirect any user trying to access comments page
function df_disable_comments_admin_menu_redirect() {
	global $pagenow;
	if ($pagenow === 'edit-comments.php') {
		wp_redirect(admin_url()); exit;
	}
}
add_action('admin_init', 'df_disable_comments_admin_menu_redirect');
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/function-to-disable-comments-in-wordpress/">Function to disable comments in WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/function-to-disable-comments-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2238</post-id>	</item>
		<item>
		<title>Function to remove Divi Projects in WordPress</title>
		<link>https://www.nick-shaw.co.uk/function-to-remove-divi-projects-in-wordpress/</link>
					<comments>https://www.nick-shaw.co.uk/function-to-remove-divi-projects-in-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Mon, 23 Oct 2023 09:55:21 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2240</guid>

					<description><![CDATA[<p>add_filter( 'et_project_posttype_args', 'mytheme_et_project_posttype_args', 10, 1 ); function mytheme_et_project_posttype_args( $args ) { return array_merge( $args, array( 'public' =&#62; false, 'exclude_from_search' =&#62; false, 'publicly_queryable' =&#62; false, 'show_in_nav_menus' =&#62; false, 'show_ui' =&#62; false )); }</p>
<p>The post <a href="https://www.nick-shaw.co.uk/function-to-remove-divi-projects-in-wordpress/">Function to remove Divi Projects in WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<pre class="brush: php; title: ; notranslate">
add_filter( 'et_project_posttype_args', 'mytheme_et_project_posttype_args', 10, 1 );
function mytheme_et_project_posttype_args( $args ) {
	return array_merge( $args, array(
		'public'              =&gt; false,
		'exclude_from_search' =&gt; false,
		'publicly_queryable'  =&gt; false,
		'show_in_nav_menus'   =&gt; false,
		'show_ui'             =&gt; false
	));
}
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/function-to-remove-divi-projects-in-wordpress/">Function to remove Divi Projects in WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/function-to-remove-divi-projects-in-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2240</post-id>	</item>
		<item>
		<title>Show remaining cost on WooCommerce site to get free shipping</title>
		<link>https://www.nick-shaw.co.uk/show-remaining-cost-on-woocommerce-site-to-get-free-shipping/</link>
					<comments>https://www.nick-shaw.co.uk/show-remaining-cost-on-woocommerce-site-to-get-free-shipping/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Wed, 22 Jun 2022 14:23:45 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[woocommerce]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2223</guid>

					<description><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [shippingleft] to get it to show up. function how_much_shipping_is_left() { $min_amount = 100; //change this to your free shipping threshold $current = WC()-&#62;cart-&#62;subtotal; if ( $current &#60; $min_amount ) { $added_text = 'Get free shipping if you order ' . wc_price( $min_amount - [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/show-remaining-cost-on-woocommerce-site-to-get-free-shipping/">Show remaining cost on WooCommerce site to get free shipping</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to the functions.php file and then add the shortcode of [shippingleft] to get it to show up.</p>
<pre class="brush: php; title: ; notranslate">
function how_much_shipping_is_left() {
   $min_amount = 100; //change this to your free shipping threshold   
   $current = WC()-&gt;cart-&gt;subtotal;  
   if ( $current &lt; $min_amount ) {
	  $added_text = 'Get free shipping if you order ' . wc_price( $min_amount - $current ) . ' more!';
	  $notice = sprintf( '%s', $added_text );
      return $notice;
   } else {
	   $notice = &quot;Order total is over £100 and shipping is free&quot;;
	   return $notice;
   } 
}
add_shortcode('shippingleft', 'how_much_shipping_is_left');
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/show-remaining-cost-on-woocommerce-site-to-get-free-shipping/">Show remaining cost on WooCommerce site to get free shipping</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/show-remaining-cost-on-woocommerce-site-to-get-free-shipping/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2223</post-id>	</item>
		<item>
		<title>WooCommerce hide Klarna payment method if order total is under £35</title>
		<link>https://www.nick-shaw.co.uk/woocommerce-hide-klarna-payment-method-if-order-total-is-under-35/</link>
					<comments>https://www.nick-shaw.co.uk/woocommerce-hide-klarna-payment-method-if-order-total-is-under-35/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Tue, 15 Feb 2022 14:24:55 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[woocommerce]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2226</guid>

					<description><![CDATA[<p>Add this to the functions.php to hide Klarna payment method if the order total is under £35 //hide klarna if order total is under £35 add_filter( 'woocommerce_available_payment_gateways', 'rudr_turn_off_cod' ); function rudr_turn_off_cod( $available_gateways ) { if( is_admin() ) { return $available_gateways; } // STEP 1: Get order/cart total if( is_wc_endpoint_url( 'order-pay' ) ) { // Pay [&#8230;]</p>
<p>The post <a href="https://www.nick-shaw.co.uk/woocommerce-hide-klarna-payment-method-if-order-total-is-under-35/">WooCommerce hide Klarna payment method if order total is under £35</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to the functions.php to hide Klarna payment method if the order total is under £35</p>
<pre class="brush: php; title: ; notranslate">
//hide klarna if order total is under £35
add_filter( 'woocommerce_available_payment_gateways', 'rudr_turn_off_cod' );
function rudr_turn_off_cod( $available_gateways ) {	
	if( is_admin() ) {
		return $available_gateways;
	}	
	// STEP 1: Get order/cart total
	if( is_wc_endpoint_url( 'order-pay' ) ) { // Pay for order page		
		$order_id = wc_get_order_id_by_order_key( $_GET&#x5B; 'key' ] );
		$order = wc_get_order( $order_id );
		$order_total = $order-&gt;get_total();		
	} else { // Cart/Checkout page
		$order_total = WC()-&gt;cart-&gt;total;
	}	
	// STEP 2: Disable payment gateway if order/cart total is less than 35
	if ( $order_total &lt; 35 ) {
		unset( $available_gateways&#x5B; 'klarna_payments' ] ); // unset klarna
	}
	return $available_gateways;
}
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/woocommerce-hide-klarna-payment-method-if-order-total-is-under-35/">WooCommerce hide Klarna payment method if order total is under £35</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/woocommerce-hide-klarna-payment-method-if-order-total-is-under-35/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2226</post-id>	</item>
		<item>
		<title>Output additional image sizes on the frontend of WordPress</title>
		<link>https://www.nick-shaw.co.uk/output-additional-image-sizes-on-the-frontend-of-wordpress/</link>
					<comments>https://www.nick-shaw.co.uk/output-additional-image-sizes-on-the-frontend-of-wordpress/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Thu, 21 Jan 2021 08:31:11 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2206</guid>

					<description><![CDATA[<p>Use this to find all the additional image sizes your site is using /* Output all image sizes on the frontend ---------------------------------------------------------------------------------------------------- */ add_action('init', 'get_all_image_sizes'); function get_all_image_sizes(){ global $_wp_additional_image_sizes; print '&#60;pre&#62;'; print_r( $_wp_additional_image_sizes ); print '&#60;/pre&#62;'; }</p>
<p>The post <a href="https://www.nick-shaw.co.uk/output-additional-image-sizes-on-the-frontend-of-wordpress/">Output additional image sizes on the frontend of WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Use this to find all the additional image sizes your site is using</p>
<pre class="brush: php; title: ; notranslate">
/* Output all image sizes on the frontend
---------------------------------------------------------------------------------------------------- */	 
add_action('init', 'get_all_image_sizes');

function get_all_image_sizes(){
    global $_wp_additional_image_sizes; 
    print '&lt;pre&gt;'; 
    print_r( $_wp_additional_image_sizes ); 
    print '&lt;/pre&gt;';
}
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/output-additional-image-sizes-on-the-frontend-of-wordpress/">Output additional image sizes on the frontend of WordPress</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/output-additional-image-sizes-on-the-frontend-of-wordpress/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2206</post-id>	</item>
		<item>
		<title>Disable Divi Custom Post Type CSS file</title>
		<link>https://www.nick-shaw.co.uk/disable-divi-custom-post-type-css-file/</link>
					<comments>https://www.nick-shaw.co.uk/disable-divi-custom-post-type-css-file/#respond</comments>
		
		<dc:creator><![CDATA[Nick]]></dc:creator>
		<pubDate>Sun, 18 Oct 2020 10:36:21 +0000</pubDate>
				<category><![CDATA[Code]]></category>
		<guid isPermaLink="false">https://www.nick-shaw.co.uk/?p=2203</guid>

					<description><![CDATA[<p>Add this to your functions files to disable/remove the Divi CPT CSS file from being used. /* Disable Divi CPT CSS */ function disable_cptdivi() { remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 ); } add_action('init', 'disable_cptdivi'); add_filter( 'woocommerce_product_tabs', 'bbloomer_remove_product_tabs', 9999 );</p>
<p>The post <a href="https://www.nick-shaw.co.uk/disable-divi-custom-post-type-css-file/">Disable Divi Custom Post Type CSS file</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Add this to your functions files to disable/remove the Divi CPT CSS file from being used.</p>
<pre class="brush: php; title: ; notranslate">
/* Disable Divi CPT CSS */
function disable_cptdivi() {
	remove_action( 'wp_enqueue_scripts', 'et_divi_replace_stylesheet', 99999998 );
}
add_action('init', 'disable_cptdivi');
add_filter( 'woocommerce_product_tabs', 'bbloomer_remove_product_tabs', 9999 );
</pre>
<p>The post <a href="https://www.nick-shaw.co.uk/disable-divi-custom-post-type-css-file/">Disable Divi Custom Post Type CSS file</a> appeared first on <a href="https://www.nick-shaw.co.uk">Nick Shaw</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.nick-shaw.co.uk/disable-divi-custom-post-type-css-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2203</post-id>	</item>
	</channel>
</rss>
