<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>WordPress &#8211; In The Digital</title>
	<atom:link href="https://inthedigital.co.uk/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>https://inthedigital.co.uk</link>
	<description>Web Design, Development and Digital Marketing</description>
	<lastBuildDate>Sun, 10 Aug 2025 08:51:55 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2018/10/cropped-in-the-digital-icon-padded.png?fit=32%2C32&#038;ssl=1</url>
	<title>WordPress &#8211; In The Digital</title>
	<link>https://inthedigital.co.uk</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">153467252</site>	<item>
		<title>2025 Digital Marketing Trends: AI, Social &#038; Search, PPC</title>
		<link>https://inthedigital.co.uk/digital-marketing-trends-2025-ai-social-search-ppc/</link>
		
		<dc:creator><![CDATA[MPXeditor]]></dc:creator>
		<pubDate>Fri, 08 Aug 2025 15:30:57 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2826</guid>

					<description><![CDATA[Explore digital marketing trends 2025: AI, GPT-5, Threads &#038; BlueSky, generative and voice search, PPC automation, essential skills and more.]]></description>
										<content:encoded><![CDATA[<p><!-- HTML version of the article for WordPress classic editor. --></p>
<p>In August 2025 the digital marketing world is moving faster than a sprinter on a mission. <strong>Artificial intelligence, new social platforms, evolving search behaviour and changing ad regulations are reshaping the way brands connect with audiences.</strong> If you want to stay relevant you need to adapt your strategies and adopt a mindset that blends technology with human creativity.</p>
<h2>Table of Contents</h2>
<ul>
<li><a href="#ai-automation">AI &amp; automation: the age of GPT‑5 and AI agents</a></li>
<li><a href="#social-platforms">New social platforms &amp; community building: Threads &amp; BlueSky</a></li>
<li><a href="#search-seo">Search &amp; SEO: generative and voice search</a></li>
<li><a href="#ppc">PPC &amp; advertising: first‑party data, automation &amp; voice search</a></li>
<li><a href="#skills">Essential skills for marketers</a></li>
<li><a href="#final">Final thoughts</a></li>
<li><a href="#faqs">FAQs</a></li>
</ul>
<h2 id="ai-automation">AI &amp; automation: the age of GPT‑5 and AI agents</h2>
<p>Artificial intelligence is no longer just a shiny add‑on; it sits at the core of modern marketing. Platforms and tools now bake AI into everything from campaign reporting to creative generation. In August 2025 OpenAI launched GPT‑5, a language model that attracted hundreds of thousands of searches within a day. Tech giants such as Microsoft and Google immediately began integrating the technology into their products, while a raft of AI platforms are making advanced capabilities accessible to marketers. Companies like xAI are also working on next‑generation models that promise more accurate multimodal search and creative tools.</p>
<p>The rise of AI agents means sfatigue”. The pressure to adopt every new tool can overwhelm teams; instead audit your workflows and use AI where it adds value, such as data analysis and automation. AI should free you to focus on strategy and creativity rather than replacing your judgement. When combining AI with human skills, remember that consumers still engage more with authentic human‑written content.</p>
<h2 id="social-platforms">New social platforms &amp; community building: Threads &amp; BlueSky</h2>
<p>Social media still commands more than two hours of our daily attention, but the landscape is shifting. As X (formerly Twitter) struggles with declining engagement, alternatives are gaining traction. Threads – Meta’s text‑based platform – already boasts hundreds of millions of users and is attractive for organic engagement with minimal adverts. BlueSky, launched by Twitter co‑founder Jack Dorsey, appeals to users seeking niche, ad‑free communities. Brands that embrace these platforms now can build audiences before competition intensifies.</p>
<p>Beyond choosing the right network, the way you create content matters. Employee‑generated content resonates with audiences: research indicates that most consumers remain loyal to brands that show openness. Encourage your team to share behind‑the‑scenes moments on LinkedIn and Threads; authenticity beats polished corporate posts. Collaborating with customers and community members also deepens relationships. Private broadcast groups or live streams offer VIP followers exclusive updates and foster a sense of belonging.</p>
<h2 id="search-seo">Search &amp; SEO: generative and voice search</h2>
<p>Traditional search is expected to decline over the coming years as users increasingly ask questions via social platforms and voice assistants. Generative AI search tools – such as Google’s AI Mode and ChatGPT – answer questions directly, and most sessions end without a click. Marketers must therefore think beyond the ten blue links.</p>
<p>Adoptoftware can autonomously run campaigns, pull data, generate reports and optiAnswer Engine Optimisation by crafting concise, question‑based content, building strong brand mentions and using clear headings and bullet lists. Add structured data and long‑tail keywords, and ensure your pages load quickly on mobile devices. The proposed <code>llms.txt</code> standard allows you to list URLs for AI crawlers; adding one now could give you a head start. Optimising for voice search is equally important: more than half of shoppers research via voice and a significant share complete purchases in this way. Use conversational phrases and location‑specific context to align with how people speak, and think about social search by optimising your profiles and creating share‑worthy content.</p>
<p>To learn more about generative search, see our in‑depth guide on <a href="https://inthedigital.co.uk/ai-search-seo-how-to-optimise-your-site-for-generative-search/">AI Search &amp; SEO</a> and our article on <a href="https://inthedigital.co.uk/digital-pr-in-the-age-of-generative-search-strategies-for-brand-visibility/">digital PR strategies for generative search</a>.</p>
<h2 id="ppc">PPC &amp; advertising: first‑party data, automation &amp; voice search</h2>
<p>Pay‑per‑click remains vital for targeted traffic, but the way we run campaigns is evolving. With privacy regulations tightening, advertisers are shifting to first‑party data. By synchronising your CRM with ad platforms you can craft messages, build look‑alike audiences and remarket effectively without relying on third‑party cookies. AI‑powered ad automation, such as Google’s Performance Max, uses machine learning to build creatives, set bids and test variations on your behalf. This frees your team for strategic work and can boost conversions.</p>
<p>To maximise your ad spend:</p>
<ol>
<li><strong>Blend SEO and PPC</strong> – sharing keyword and performance data across channels improves both visibility and efficiency.</li>
<li><strong>Embrace conversion rforms and calls to action on your landing pages to extract more value from every click.</strong></li>
<li><strong>Target hyper‑local searches</strong> – personalise your copy and use Google Maps extensions to capture local intent from users searching “near me”.</li>
<li><strong>Watch your budgets</strong> – CPCs are rising in competitive verticals. Reallocate spend to high‑impact channels and long‑tail keywords that deliver real business value.</li>
<li><strong>Optimise for voice and visual search</strong> – create conversational ad copy and experiment with visual formats such as image‑based shopping ads.</li>
<li><strong>Diversify platforms</strong> – don’t rely solely on Google. Explore Bing, LinkedIn, Amazon and TikTok to reach niche audiences and potentially lower CPCs.</li>
<li><strong>Focus on your audience, not just keywords</strong> – build campaigns around behaviour and intent data.</li>
<li><strong>Stay ethical and transparent</strong> – respect user privacy and clearly label AI‑generated content. Transparency builds trust in a world of automated advertising.</li>
</ol>
<p>For more on emerging ad regulations, see our recent post on <a href="https://inthedigital.co.uk/eu-political-ads-knowing-google-ads-new-rules/">Google’s new rules for EU political ads</a>.</p>
<h2 id="skills">Essential skills for marketers</h2>
<p>As AI automates routine work, human skills become more valuable. Collaborative problem solving has grown rapidly in recent years. Soft skills like active listening, leadership and teamwork differentiate successful marketers. At the same time there is a widening AI skills gap among senior marketing leaders. Learn to use tools like ChatGPT for research, analytics platforms for insights and AI agents for automation. Finally, develop business acumen; understanding finance and strategy helps you align marketing campaigns with organisational goals. Pursuing continuous learning – whether through online courses or mentoring – will keepate oyour skills sharp.</p>
<h2 id="final">Final thoughts</h2>
<p>Digital marketing in 2025 is a balancing act between embracing innovation and staying grounded in human connection. AI agents, new social networks and evolving search behaviours offer exciting opportunities, but success comes from combining these tools with empathy, curiosity and a clear strategy. Regularly audit your workflows, refresh your content and experiment with platforms early to stay ahead of the curve. As always, if you need help navigating this fast‑moving landscape, we’re here to support you.</p>
<h2 id="faqs">FAQs</h2>
<h3>What are AI agents and how do they help marketers?</h3>
<p>AI agents are software systems that autonomously manage marketing tasks such as pulling data, creating ads and optimising campaigns in real time. They free teams from repetitive work so you can focus on strategy, but they require thoughtful implementation to avoid overwhelming your processes.</p>
<h3>How can I avoid AI fatigue in my marketing team?</h3>
<p>Don’t adopt every shiny tool. Identify where AI can genuinely add value – for example by automating reports or analysing large data sets – and integrate it gradually. Encourage your team to prioritise creativity and human judgement over automation.</p>
<h3>Why should I care about voice search?</h3>
<p>Voice assistants are increasingly used for shopping and research. Optimising your content and ads for conversational queries ensures you appear in these results and gives customers the answers they need without switching devices.</p>
<h3>Which new social platforms should I watch?</h3>
<p>Threads and BlueSky are two text‑first networks attracting users who are disengaging from X. Threads already has hundreds of millions of users and BlueSky appeals to niche, ad‑free communities. Experimenting with these platforms now can help you build engaged audiences before they become crowded.</p>
<p>ptimisation – test headlines,mise ads in real time. These agents promise greater efficiency, but marketers need to deploy them wisely to avoid “AI</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2826</post-id>	</item>
		<item>
		<title>Shop Feed: Missing Color, Age and Gender values in Google Merchant Center</title>
		<link>https://inthedigital.co.uk/shop-feed-missing-color-age-and-gender-values-in-google-merchant-center/</link>
					<comments>https://inthedigital.co.uk/shop-feed-missing-color-age-and-gender-values-in-google-merchant-center/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Tue, 26 Nov 2024 18:13:37 +0000</pubDate>
				<category><![CDATA[Adwords PPC]]></category>
		<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[Pay Per Click]]></category>
		<category><![CDATA[WooCommerce]]></category>
		<category><![CDATA[Missing value]]></category>
		<category><![CDATA[Shop]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2742</guid>

					<description><![CDATA[<img width="300" height="231" src="https://i2.wp.com/inthedigital.co.uk/wp-content/uploads/2024/11/google-merchant-center-missing-values.png?fit=300%2C231&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="How to fix: Missing value: size [size], colour [color], gender [gender], age group [age_group]" style="float: none; margin: auto;" decoding="async" fetchpriority="high" />How to fix: Missing value: size [size], colour [color], gender [gender], age group [age_group] in feeds for Google Merchant Center and Google Ads]]></description>
										<content:encoded><![CDATA[<img width="300" height="231" src="https://i2.wp.com/inthedigital.co.uk/wp-content/uploads/2024/11/google-merchant-center-missing-values.png?fit=300%2C231&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="How to fix: Missing value: size [size], colour [color], gender [gender], age group [age_group]" style="float: none; margin: auto;" decoding="async" /><p>Missing value: size [size], color [color], gender [gender], age group [age_group]. Are you getting any of these notifications in Google Merchant Center and Googe Ads? If so, here are several different ways to fix it.</p>
<h2 style="margin-bottom: 0!important;">Overview: ways to fix the feed</h2>
<ol>
<li>Create Product Attributes</li>
<li>Create Product Custom Meta</li>
<li>Create Literal Value in the Feed</li>
<li>Update Feed Manually in Google Merchant Center</li>
</ol>
<p>Any of the above will fix the issue with missing values. I&#8217;ll elaborate on each approach at a later date. For now, if you need help, reach out and I&#8217;ll help/update the post.</p>
<h2 style="margin-bottom: 0!important;">Resources</h2>
<ul>
<li>Color attribute&#8217;s acceptable values:<br />
<a href="https://support.google.com/merchants/answer/6324487" target="_blank" rel="noopener nofollow">https://support.google.com/merchants/answer/6324487</a></li>
<li>Age attribute&#8217;s acceptable values:<br />
<a href="https://support.google.com/merchants/answer/6324463" target="_blank" rel="noopener nofollow">https://support.google.com/merchants/answer/6324463</a></li>
<li>Gender attribute&#8217;s acceptable values:<br />
<a href="https://support.google.com/merchants/answer/6324479" target="_blank" rel="noopener nofollow">https://support.google.com/merchants/answer/6324479</a></li>
</ul>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/shop-feed-missing-color-age-and-gender-values-in-google-merchant-center/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2742</post-id>	</item>
		<item>
		<title>How to import and export all WordPress users using WP CLI</title>
		<link>https://inthedigital.co.uk/how-to-import-and-export-all-wordpress-users-using-wp-cli/</link>
					<comments>https://inthedigital.co.uk/how-to-import-and-export-all-wordpress-users-using-wp-cli/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Thu, 12 Aug 2021 11:21:34 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[CLI]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[WP CLI]]></category>
		<category><![CDATA[WP Import]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2501</guid>

					<description><![CDATA[Like everything with WordPress, there&#8217;s usually a plugin to help, but we don&#8217;t need one to import users as WP CLI can do this. Here&#8217;s the simple process, starting with exporting the user from an existing WP database. We&#8217;ll refer to the source database as source-db and the target database as target-db and I&#8217;ll assume [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Like everything with WordPress, there&#8217;s usually a plugin to help, but we don&#8217;t need one to import users as WP CLI can do this.</p>
<p>Here&#8217;s the simple process, starting with exporting the user from an existing WP database. We&#8217;ll refer to the source database as <strong>source-db</strong> and the target database as <strong>target-db</strong> and I&#8217;ll assume you have access to both WordPress instances via WP CLI.</p>
<h2>Step 1. Export WordPress users</h2>
<p>This step will be working with the source-db.</p>
<ul>
<li>note the asterisk in the table name &#8211; use this to save typing the exact table name for your specific WordPress database</li>
<li>note the name of the exported file, users.sql &#8211; this makes it clear to identify the contents of this file</li>
</ul>
<pre><code>$ wp db export --tables=$(wp db tables &#039;wp_*_users&#039;) users.sql</code></pre>
<h2>Step 2. Export WordPress usermeta</h2>
<p>This step will be wokring with the source-db.</p>
<ul>
<li>as above, note the wildcard and filename</li>
</ul>
<pre><code>$ wp db export --tables=$(wp db tables &#039;wp_*_usermeta&#039;) usermeta.sql</code></pre>
<h2>Step 3. Optional backup of users and usermeta</h2>
<p>This step will be working with the target-db. It&#8217;s an optional backup of the users and usermeta tables before importing the new data.</p>
<ul>
<li>repeat step 1 (but working with the target-db)</li>
<li>name the file backup-users.sql</li>
<li>repeat step 2 (but working with the target-db)</li>
<li>name the file backup-usermeta.sql</li>
</ul>
<h2>Step 4. Move the exported files to an accessible location for importing</h2>
<p>If you have GUI access to both file systems, then you can simply copy/download users.sql and usermeta.sql from the source instance and paste them into the target instance. I used rsync (but scp will work) to copy from a remote server to a local development server. I was working in the target instance of WordPress via the commandline:</p>
<pre>users.sql: <code>$ rsync -azP user@source:path/to/file/users.sql .</code></pre>
<pre>usermeta.sql: <code>$ rsync azP user@source:path/to/file/usermeta.sql .</code></pre>
<ul>
<li>note the <code>.</code> at the end, this just means the destination path is the current directory. You can state the relative path if needed</li>
</ul>
<h2>Step 5. Import WordPress users</h2>
<p>This step will be working with the target-db.</p>
<pre><code>$ wp db import users.sql</code></pre>
<h2>Step 6. Import WordPress usermeta</h2>
<p>This step will be working with the target-db.</p>
<pre><code>$ wp db import usermeta.sql</code></pre>
<h2>Step 7. Optional cleanup</h2>
<p>This is an optional step to delete exported, but it&#8217;s one I&#8217;d strongly recommend doing it, especially if you&#8217;ve got the users.sql and usermeta.sql files sitting in a public folder.</p>
<ul>
<li>repeat this step for each WordPress instance</li>
</ul>
<pre><code>$ rm users.sql usermeta.sql</code></pre>
<pre><code>$ rm backup-users.sql backup-usermeta.sql</code></pre>
<h2>Conclusion</h2>
<p>Using WP CLI makes this a very easy process that only take a couple of minutes. On top of that it saves using yet another plugin to carry out a simple task. If you&#8217;d like help with this or any other WordPress related challenge, please <a href="https://inthedigital.co.uk/contact-us/">get in touch</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/how-to-import-and-export-all-wordpress-users-using-wp-cli/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2501</post-id>	</item>
		<item>
		<title>The awesome Delicious Brains team acquire ACF &#038; ACF Pro!</title>
		<link>https://inthedigital.co.uk/the-awesome-delicious-brains-team-acquire-acf-acf-pro/</link>
					<comments>https://inthedigital.co.uk/the-awesome-delicious-brains-team-acquire-acf-acf-pro/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Thu, 10 Jun 2021 04:12:35 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Development]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2441</guid>

					<description><![CDATA[<img width="250" height="250" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2021/06/acf.jpg?fit=250%2C250&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Advanced Custom Fields (ACF)" style="float: none; margin: auto;" decoding="async" />So, ACF, one of the best developer plugins of the last century, is now part of the Delicious Brains family. What does this mean for ACF, ACF Pro and the vast ACF client base? What are ACF and ACF Pro? Elliot Condon, the sole developer behind ACF to date, has made one of the most [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="250" height="250" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2021/06/acf.jpg?fit=250%2C250&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Advanced Custom Fields (ACF)" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>So, ACF, one of the best developer plugins of the last century, is now part of the Delicious Brains family. What does this mean for ACF, ACF Pro and the vast ACF client base?</p>
<h2>What are ACF and ACF Pro?</h2>
<p>Elliot Condon, the sole developer behind ACF to date, has made one of the most goto developer-focused plugins of the last 10 years. It&#8217;s so good for WordPress that I don&#8217;t think I&#8217;m alone in saying that he has single-handedly had a major impact on the success of the WordPress platform!</p>
<p><a href="https://www.advancedcustomfields.com/" target="_blank" rel="noopener noreferrer nofollow">ACF</a> (Advanced Custom Fields) is a well-thought-out, feature-rich plugin that allows developers to easily manage the editing experience and data collection for custom solutions. It&#8217;s primarily used to manage custom meta fields in the <code>postmeta</code> table, but does a lot more. We&#8217;ve used <a href="https://www.advancedcustomfields.com/pro/" target="_blank" rel="noopener noreferrer nofollow">the Pro version</a> on many, many client <a href="https://inthedigital.co.uk/#we-create-and-build-content" target="_blank" rel="noopener noreferrer">websites</a> to solve a myriad of challenges, from making it easier for clients to manage their content to extending product data on e-commerce shops. It&#8217;s incredibly stable and has evolved wonderfully over the years. I don&#8217;t think I would use WordPress anywhere near as much without it!</p>
<h2>Who are Delicious Brains?</h2>
<p>If you&#8217;re a WordPress developer, then it&#8217;s very likely you&#8217;ve needed to migrate or copy a WordPress database. There are a few ways to do this and in my very early days of working with WordPress, I found it so ugly migrating the database that it actually made me almost lose interest in the platform. Eventually, I found ways to work with it, such as <a href="https://snapcreek.com/" target="_blank" rel="noopener noreferrer nofollow">Duplicator Pro</a> (another great plugin), but the process became a dream (and somewhat exciting) when I started using <a href="https://deliciousbrains.com/wp-migrate-db-pro/" target="_blank" rel="noopener noreferrer nofollow">WP Migrate DB Pro</a>. The guys from DB had not only solved one of the shittiest chores in WordPress, they&#8217;d made it a pleasant experience &#8211; come on, those green progress bars are somehow very mesmerising!</p>
<h2>Why is ACF being acquired by Delicious Brains?</h2>
<p>Listening to <a href="https://deliciousbrains.com/epic-wordpress-announcement/" target="_blank" rel="noopener noreferrer nofollow">their podcast</a> regarding the announcement, the acquisition seems to be a perfect fit for both parties &#8211; Elliot gets to enjoy life outside his laptop (his words) and Delicious Brains get to take on one of the most goto plugins for WordPress.</p>
<p>What&#8217;s very clear from the podcast is that this seems like an excellent fit, as ACF has been carefully crafted and evolved over the last 10 years, but at the hands of a single, passionate developer. Whereas, with DB, which makes awesome WP plugins, it will get the expertise from the whole, growing team, whilst keeping the same attention to detail that we&#8217;ve come to take for granted from Elliot&#8217;s work.</p>
<h2>Will the pricing change?</h2>
<p>Who knows? At this stage Brad at DB has stated that there will be no change to the pricing structure that&#8217;s already in place, <a href="https://deliciousbrains.com/epic-wordpress-announcement/#lifetime" target="_blank" rel="noopener noreferrer nofollow">even lifetime will be honoured</a>, and looking at how DB&#8217;s offerings are priced versus how ACF Pro is, I think they&#8217;re pretty aligned already, so would not expect any scare surprises &#8211; we&#8217;ll see.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/the-awesome-delicious-brains-team-acquire-acf-acf-pro/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2441</post-id>	</item>
		<item>
		<title>3 Ways to Improve PageSpeed by Moving jQuery to the Footer of a WordPress site.</title>
		<link>https://inthedigital.co.uk/3-ways-to-improve-pagespeed-by-moving-jquery-to-the-footer-of-a-wordpress-site/</link>
					<comments>https://inthedigital.co.uk/3-ways-to-improve-pagespeed-by-moving-jquery-to-the-footer-of-a-wordpress-site/#comments</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Tue, 27 Oct 2020 12:35:37 +0000</pubDate>
				<category><![CDATA[WP Snippets]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[JS to Footer]]></category>
		<category><![CDATA[Move jQuery to footer]]></category>
		<category><![CDATA[PageSpeed]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2383</guid>

					<description><![CDATA[Here&#8217;s how to improve your site&#8217;s rating on Google&#8217;s PageSpeed by moving render-blocking jQuery to the footer. If you&#8217;ve ever tried to improve a site&#8217;s performance on Google&#8217;s PageSpeed, you&#8217;ve probably seen that one of the &#8220;Opportunities&#8221; is to &#8220;Eliminate render-blocking resources&#8221;. These resources are typically CSS and JavaScript files. Usually, it&#8217;s not easy to [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Here&#8217;s how to improve your site&#8217;s rating on Google&#8217;s PageSpeed by moving render-blocking jQuery to the footer.</p>
<p>If you&#8217;ve ever tried to improve a site&#8217;s performance on Google&#8217;s PageSpeed, you&#8217;ve probably seen that one of the &#8220;Opportunities&#8221; is to &#8220;Eliminate render-blocking resources&#8221;. These resources are typically CSS and JavaScript files. Usually, it&#8217;s not easy to remove/move the CSS resources as this will often result in a FOUC, (<a href="https://developers.google.com/web/fundamentals/performance/critical-rendering-path/render-blocking-css#tldr" target="_blank" rel="noopener noreferrer nofollow">flash of unstyled content</a>). However, in most cases, you can get away with moving pretty much all JavaScript to the, as long as you&#8217;re not using it to style the content in the viewport (usually this is the &#8220;above-the-fold&#8221;), so let&#8217;s do that!</p>
<h2>How to Move Common JavaScript Resources to the Footer</h2>
<p>First, let&#8217;s look at the most common of JavaScript resources; <strong>jQuery</strong>. Even though jQuery isn&#8217;t as popular as it once was, it&#8217;ll be around for the foreseeable future as a vast number of JavaScript solutions are built on top of it. Plus, it&#8217;s been baked into WordPress for many years, too!</p>
<p>Here are 3 ways to move it to the footer and the logic used here can be used with other JS libraries, too.</p>
<h3>1. Add data to the enqueued scripts</h3>
<p>Using wp_scripts-&gt;<a href="https://developer.wordpress.org/reference/classes/WP_Dependencies/add_data/" target="_blank" rel="noopener noreferrer nofollow">add_data()</a>, this will add the a key/value pair (&#8216;group&#8217; and 1) to the targeted script. Note that &#8216;group&#8217; is WordPress&#8217;s way of determining if the script goes in the head or footer, 1 will put in in the footer. key/value (group/1):</p>
<pre><code class="language-php">add_action(&#039;wp_enqueue_scripts&#039;, function() {
    wp_scripts()-&gt;add_data(&#039;jquery&#039;, &#039;group&#039;, 1);
    wp_scripts()-&gt;add_data(&#039;jquery-core&#039;, &#039;group&#039;, 1);
    wp_scripts()-&gt;add_data(&#039;jquery-migrate&#039;, &#039;group&#039;, 1);
});</code></pre>
<h3>2. Dequeue existing scripts and enqueue new scripts</h3>
<p>This approach is handy if you want to change the source, such as loading from a CDN:</p>
<pre><code class="language-php">function dequeue_head_scripts_enqueue_footer_scripts() {
    wp_deregister_script(&#039;jquery&#039;);
    wp_register_script(&#039;jquery&#039;, &#039;https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js&#039;, false, null, true);
    wp_enqueue_script(&#039;jquery&#039;);
}
add_action(&#039;wp_enqueue_scripts&#039;, &#039;dequeue_head_scripts_enqueue_footer_scripts&#039;, 10);</code></pre>
<h3>3. Move all scripts out of the head</h3>
<p>This way move all JS out of the head and into the footer but feels a little extreme with no granular control:</p>
<pre><code class="language-php">function move_scripts_to_footer() {
    remove_action(&#039;wp_head&#039;, &#039;wp_print_scripts&#039;);
    remove_action(&#039;wp_head&#039;, &#039;wp_print_head_scripts&#039;, 1);
    remove_action(&#039;wp_head&#039;, &#039;wp_enqueue_scripts&#039;, 1);
}
add_action(&#039;wp_enqueue_scripts&#039;, &#039;move_scripts_to_footer&#039;);</code></pre>
<h2>Conclusion</h2>
<p>In my opinion option one is the best fit (even though it feels a little ugly retrospectively changing it using &#8216;group&#8217;), as there&#8217;s no need to remove the default jQuery and you can keep tight control over which scripts are in the head and which are somewhere else. If you&#8217;d like help with this, or you have an odd edge case where none of these approaches are working, then <a href="https://inthedigital.co.uk/contact-us/">please get in touch</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/3-ways-to-improve-pagespeed-by-moving-jquery-to-the-footer-of-a-wordpress-site/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2383</post-id>	</item>
		<item>
		<title>How to Use WebP Images With Modern Browsers</title>
		<link>https://inthedigital.co.uk/how-to-use-webp-images-with-modern-browsers/</link>
					<comments>https://inthedigital.co.uk/how-to-use-webp-images-with-modern-browsers/#respond</comments>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Mon, 31 Aug 2020 20:49:33 +0000</pubDate>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Image Optimisation]]></category>
		<category><![CDATA[WebP]]></category>
		<category><![CDATA[WebP Rewrites]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2161</guid>

					<description><![CDATA[<img width="300" height="214" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/08/nginx-webp-rewrites.jpg?fit=300%2C214&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Nginx WebP Rewrites" style="float: none; margin: auto;" decoding="async" loading="lazy" />WebP is the next generation image file type. WebP images are comparatively smaller file sizes. See how you can use WebP on your website.]]></description>
										<content:encoded><![CDATA[<img width="300" height="214" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/08/nginx-webp-rewrites.jpg?fit=300%2C214&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Nginx WebP Rewrites" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Using <a href="https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types#WebP" target="_blank" rel="noopener noreferrer nofollow">WebP images</a> instead of PNG, JPG and GIF images is a great way to speed up your website. Oh, and Google loves Webp, too. There are several ways you can implement WebP images on your website, but I&#8217;m going to focus on the easiest way for WordPress sites.</p>
<p>WordPress has a multitude of plugins to help with this challenge. Some are free, but I&#8217;d avoid these as the premium offerings are great and the cost is a small trade-off for implementing WebP without having to reinvent the wheel.</p>
<h2>My Favourite WordPress Plugin for WebP Images.</h2>
<p>I&#8217;ve done a ton of research and testing to find a decent plugin for this job and, after much trial and error, the I&#8217;ve happily settled with <a href="https://imagify.io/" target="_blank" rel="noopener noreferrer nofollow">Imagify</a>, by WP Rocket.</p>
<p>Note that this plugin has a free tier that you can use to test the water, in fact, for many sites this option might well be all that&#8217;s needed! However, should you need to swing over to a paid tier, then you&#8217;re not going to lose any sleep, as 1GB of data per month (about 10k images) will set you back the cost of a coffee or two.</p>
<h2>Picture Element or Rewrites?</h2>
<p>Having tried both approaches I found rewrites better, as using the <code>picture</code> element didn&#8217;t address background images. Plus rewrites meant the codebase didn&#8217;t need to change, which could be a problem if you&#8217;re using this on a theme you don&#8217;t have control over, such as an off-the-shelf theme.</p>
<h2>Apache or Nginx?</h2>
<p>If you&#8217;re using Apache, you can install the plugin and you&#8217;re good to go, as the <strong>.htaccess</strong> file will be updated to handle the rewrites. However, if, like me, you&#8217;re using Nginx, you&#8217;ll need to edit the config file manually. Just add the following to <strong>nginx.config</strong>:</p>
<pre><code class="language-nginx">location ~* ^(/.+)\.(jpg|jpeg|jpe|png|gif)$ {
    add_header Vary Accept;

    if ($http_accept ~* &quot;webp&quot;){
        set $imwebp A;
    }
    if (-f $request_filename.webp) {
        set $imwebp  &quot;${imwebp}B&quot;;
    }
    if ($imwebp = AB) {
        rewrite ^(.*) $1.webp;
    }
}</code></pre>
<p><span class="hidden">source: https://imagify.io/documentation/my-images-are-broken/</span><br />
With the rewrites in place, all that&#8217;s left is to run the bulk optimisation on the media library (or your other directories!) and clear any caches.</p>
<h2>Don&#8217;t just serve WebP, optimise your images, too!</h2>
<p>Oh, it&#8217;s also worth mentioning that most decent image optimisation plugins also include WebP handling, so you&#8217;re not just getting modern file types, you&#8217;ll also get squished and squeezed assets, too. So even those browsers that don&#8217;t support WebP can still server compressed images, even if they&#8217;re a little behind the curve.</p>
<h2>Need help or advice on image optimisation?</h2>
<p>If you&#8217;d like to implement WebP but you&#8217;re encountering challenges, please <a href="https://inthedigital.co.uk/contact-us/">get in touch</a> and we&#8217;ll be happy to see if we can help.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://inthedigital.co.uk/how-to-use-webp-images-with-modern-browsers/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2161</post-id>	</item>
		<item>
		<title>How to Move a Meta Box in WordPress</title>
		<link>https://inthedigital.co.uk/how-to-move-a-meta-box-in-wordpress/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Sun, 02 Aug 2020 19:40:08 +0000</pubDate>
				<category><![CDATA[WordPress development]]></category>
		<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[Meta box]]></category>
		<category><![CDATA[Re-odering meta boxes]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2031</guid>

					<description><![CDATA[<img width="300" height="146" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2020/08/move-a-meta-box.png?fit=300%2C146&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="How to move a WordPress meta box" style="float: none; margin: auto;" decoding="async" loading="lazy" />Sometimes you want to programmatically move a WordPress meta box to a more ideal position on the editor screen. Here's my way, with code.]]></description>
										<content:encoded><![CDATA[<img width="300" height="146" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2020/08/move-a-meta-box.png?fit=300%2C146&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="How to move a WordPress meta box" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Have you ever needed to programmatically move a meta box in the WordPress editor screen? Maybe you&#8217;ve needed to change its priority or position? I know I have, many times.</p>
<p>Recently, I needed to move a meta box to the top of the editor screen, just under the main editor (in &#8216;classic editor&#8217; mode) and all the usual suspects had no answers. So here&#8217;s my solution, which I think is pretty robust.</p>
<h2>Using the &#8216;edit_form_after_title&#8217; hook</h2>
<p>This hook is the perfect just-in-time point to jump in and update the <code>$wp_meta_boxes</code> global variable. I&#8217;m using it in conjunction with <code>$current_screen</code> to ascertain the current admin screen, then I&#8217;m looking through the &#8216;high&#8217; meta boxes and removing the one I&#8217;m looking for. Why? Because it can then be prepended to the array, forcing it to be the first of the &#8216;high&#8217; meta boxes.</p>
<h2>Here&#8217;s the code to move a meta box titled &#8216;PriceList&#8217; to the top</h2>
<p>NB: the action hook, <code>edit_form_after_title</code>, has one parameter; the <code>WP_Post</code> object, but it&#8217;s not needed in this instance.</p>
<pre><code class="language-php">/**
 * Move the &#039;pricelist&#039; meta box to top of the &#039;high&#039; area of the editor screen
 */
add_action(&#039;edit_form_after_title&#039;, function () {
    global $current_screen, $wp_meta_boxes;

    // only do stuff if this is the editor screen for the post type &#039;project&#039; and it has meta boxes
    if ($current_screen-&gt;id === &#039;project&#039; &amp;&amp; isset($wp_meta_boxes[&#039;project&#039;])) {

        // loop though &#039;high&#039; meta boxes
        foreach ($wp_meta_boxes[&#039;project&#039;][&#039;normal&#039;][&#039;high&#039;] as $key =&gt; $high_box) {

            // do stuff if the meta box with the title &#039;PriceList&#039; is found
            if ($high_box[&#039;title&#039;] === &#039;PriceList&#039;) {
                // grab the meta box
                $meta_box = [$key =&gt; $high_box];

                // remove it from the array of &#039;high&#039; meta boxes
                unset($wp_meta_boxes[&#039;project&#039;][&#039;normal&#039;][&#039;high&#039;][$key]);

                // add it to the start of the array
                $wp_meta_boxes[&#039;project&#039;][&#039;normal&#039;][&#039;high&#039;] = $meta_box + $wp_meta_boxes[&#039;project&#039;][&#039;normal&#039;][&#039;high&#039;];
            }
        }
    }
}, 100);</code></pre>
<p>As can be seen from the code above, the target meta box will now be the first one in the array, as required.</p>
<h2>Are there other ways to move meta boxes?</h2>
<p>As with most things in life the answer&#8217;s <em>yes! </em>You could manually move them by dragging them to the desired position, but this is a per-user setting, so not ideal if you want to set the default layout for all users. You could use <code>&lt;a href=&quot;https://developer.wordpress.org/reference/functions/do_meta_boxes/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;do_meta_boxes()&lt;/a&gt;</code> and <code>&lt;a href=&quot;https://developer.wordpress.org/reference/functions/remove_meta_box/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;remove_meta_box()&lt;/a&gt;</code> to remove the target meta box, then add it back where required, using <code>&lt;a href=&quot;https://developer.wordpress.org/reference/functions/add_meta_box/&quot; target=&quot;_blank&quot; rel=&quot;noopener noreferrer&quot;&gt;add_meta_box()&lt;/a&gt;</code> You can even use custom hooks provided by plugins, where they&#8217;re available, which is what I used to <a href="https://inthedigital.co.uk/501-2/">move the Yoast meta box to the bottom of the screen</a>.</p>
<h2>Need help with technical WordPress challenges?</h2>
<p>If you&#8217;d like help with WordPress please <a href="https://inthedigital.co.uk/contact-us/">get in touch and we can discuss your particular challenge</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2031</post-id>	</item>
		<item>
		<title>Ordering nested comments by the latest reply</title>
		<link>https://inthedigital.co.uk/ordering-nested-comments-by-the-latest-reply/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Thu, 25 Jun 2020 10:09:02 +0000</pubDate>
				<category><![CDATA[WordPress development]]></category>
		<category><![CDATA[Bespoke WordPress]]></category>
		<category><![CDATA[Comment ordering]]></category>
		<category><![CDATA[Commenting]]></category>
		<category><![CDATA[Comments]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=2006</guid>

					<description><![CDATA[<img width="300" height="235" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/06/comment-ordering-by-replies-e1626806713219.png?fit=300%2C235&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Screenshot of commenting ordering with nested comments" style="float: none; margin: auto;" decoding="async" loading="lazy" />WordPress orders its comments by oldest or newest first. So how do you go about ordering nested comments by the age of respective replies?]]></description>
										<content:encoded><![CDATA[<img width="300" height="235" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/06/comment-ordering-by-replies-e1626806713219.png?fit=300%2C235&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Screenshot of commenting ordering with nested comments" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>I&#8217;ve recently been working on a project that has pretty active comment threads and needed to control the ordering of nested comments. To improve the user experience we decided it would be much clearer to show the newest activity at the top of the comments.</p>
<p>Now, you may be thinking that WordPress has a setting for that?</p>
<p><em>It does not.</em></p>
<p>Via WordPress, <a href="https://wordpress.com/support/comment-display-options/" target="_blank" rel="noopener noreferrer nofollow">you can order the top-level comments</a>, but not the nested replies.</p>
<h2>Nest Comments Scenario:</h2>
<ol>
<li>10 top-level comments.</li>
<li>Each top-level comment has its own multi-level replies.</li>
</ol>
<p>With out-the-box ordering, top-level comments can only be sorted by <em>oldest-to-newest</em> or <em>newest-to-oldest</em>. We need them to be sorted by the <em>multi-level replies&#8217; timestamp</em>.</p>
<h2>So How Do We Order Nested Comments to Sort Top-Level Comments By Their Replies?</h2>
<p>It&#8217;s actually relatively simple:</p>
<ol>
<li>Each top-level comment gets a timestamp when it&#8217;s created &#8211; this is separate from its date because they have different uses.</li>
<li>This timestamp is used as the <code>orderby</code> argument for the comments query.</li>
<li>Then, whenever any top-level comment or associated reply receives a reply the top-level comment timestamp is updated.</li>
</ol>
<p>It&#8217;s that simple.</p>
<p>&nbsp;</p>
<p><img loading="lazy" decoding="async" class="size-large wp-image-2012 alignnone" src="https://i2.wp.com/inthedigital.co.uk/wp-content/uploads/2020/06/comment-ordering-by-replies.png?resize=1024%2C803&#038;ssl=1" alt="Screenshot of commenting ordering" width="1024" height="803" data-recalc-dims="1" /></p>
<p>Ordering nested comments in this way is a nice way to keep active threads at the top of the comment list. If you&#8217;d like to implement this clean and effective enhancement for your comments, please <a href="https://inthedigital.co.uk/contact-us/">get in touch</a> to find out more.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">2006</post-id>	</item>
		<item>
		<title>How to Remove HTML Comments from the Page Source</title>
		<link>https://inthedigital.co.uk/how-to-remove-html-comments/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Thu, 20 Feb 2020 10:09:30 +0000</pubDate>
				<category><![CDATA[WP Snippets]]></category>
		<category><![CDATA[Code snippet]]></category>
		<category><![CDATA[Removing html comment]]></category>
		<category><![CDATA[Website performance]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=1832</guid>

					<description><![CDATA[<img width="300" height="273" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/02/remove-html-comments.png?fit=300%2C273&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Hot to remove HTML comments from the page&#039;s source code | In The Digital" style="float: none; margin: auto;" decoding="async" loading="lazy" />Many plugins (and themes) inject HTML comments into the page's source code that aren't really needed in your a live site. Here's how to remove them.]]></description>
										<content:encoded><![CDATA[<img width="300" height="273" src="https://i0.wp.com/inthedigital.co.uk/wp-content/uploads/2020/02/remove-html-comments.png?fit=300%2C273&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Hot to remove HTML comments from the page&#039;s source code | In The Digital" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Many plugins inject unnecessary HTML comments into the page&#8217;s source code. Let&#8217;s look into ways we could remove them.</p>
<h2>Why do you want HTML comments in the first place?</h2>
<p>It is a pet hate of mine that HTML gets flooded with unnecessary tripe, such as comments that relate to a section of the HTML. In WordPress loads of plugins dump this crap into the page, but why? In my opinion, as a programmer, a live site is no place for this bloat. Sure, if you feel the need to output them for debugging purposes, in development/staging, then do so &#8211; though I&#8217;m still not sure why you would, as there are proper debugging tools and techniques for that. But a live site should be optimised; only transmitting data that are necessary for the presentation and functionality of the site, so let&#8217;s try to achieve that.</p>
<h2>How can these HTML comments be removed?</h2>
<p>There’s more than one way to remove these comments, and, in some cases, the best solution is to stop them being created in the first place, but that’s not so easy when you don&#8217;t always have control over third-party code that&#8217;s creating them.</p>
<p>Yoast, a third-party plugin for SEO, have provided us with a way to achieve this. Here&#8217;s an example of how to remove comments that Yoast injects:</p>
<pre><code class="language-php">/**
* Disable Yoast&#039;s comments
*/
add_action(&#039;template_redirect&#039;, function () {
    // abort if the class doesn’t exist
    if (!class_exists(&#039;WPSEO_Frontend&#039;)) return;

    // set probable method (Yoast updates this from time-to-time)
    $method = ‘debug_mark’;

    // get instance
    $instance = WPSEO_Frontend::get_instance();

    // abort if the method doesn’t exist
    if (!method_exists($instance, $method)) return;

    // remove the method
    remove_action(‘wpseo_head’, [$instance, $method], 2);
}, 9999);</code></pre>
<p>Note that the code above is fairly volatile, as it will only work if Yoast doesn’t change the classes and hooks being called.</p>
<h2>Remove all HTML comments</h2>
<p>The above code snippet only addresses the comments in the <code>head</code> tag by a single plugin. There are techniques to remove all comments from the page. One way is to buffer all the page&#8217;s source code and use a regular expression to remove anything between <code>&lt;!--</code> and <code>--&gt;</code> before outputting the buffer&#8217;s contents. Personally, I don&#8217;t think this is a nice solution, as it will probably slow your site unless you cached the results, nonetheless, here&#8217;s a theoretical solution (untested):</p>
<pre><code class="language-php">/**
 * Callback function to remove HTML comments
 */
function buffer_callback($buffer) {
    return preg_replace(&#039;/&lt;!--(.|s)*?--&gt;/&#039;, &#039;&#039;, $buffer);
}

// start buffer at the site&#039;s head
add_action(&#039;get_header&#039;, function () {
    ob_start(&#039;buffer_callback&#039;);
});

// end buffer and flush after the WP Footer&#039;s content&#039;s been collected
add_action(&#039;wp_footer&#039;, function () {
    ob_end_flush();
});</code></pre>
<h2>Are There Other Ways to Clear Out the Noise?</h2>
<p>Whilst searching the entire document for specific strings of characters isn’t ideal, it is a solution. Alternatively, we could investigate ways that prevent the creation of them in the first place, but that&#8217;s easier said than done. If I create one I&#8217;ll share my findings.</p>
<p>If you have a suggestion or you&#8217;d like to discuss implementing something like this on your site, then please <a href="https://inthedigital.co.uk/contact-us/">get in touch</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1832</post-id>	</item>
		<item>
		<title>Extracting Thumbnails from Videos</title>
		<link>https://inthedigital.co.uk/extracting-thumbnails-from-videos-in-wordpress/</link>
		
		<dc:creator><![CDATA[Mervyn Booth]]></dc:creator>
		<pubDate>Tue, 18 Feb 2020 14:52:23 +0000</pubDate>
				<category><![CDATA[WP Snippets]]></category>
		<category><![CDATA[Code snippet]]></category>
		<category><![CDATA[Dev Tricks]]></category>
		<category><![CDATA[Feature images]]></category>
		<category><![CDATA[Thumbnails]]></category>
		<category><![CDATA[Video thumbnail]]></category>
		<guid isPermaLink="false">https://inthedigital.co.uk/?p=1848</guid>

					<description><![CDATA[<img width="300" height="253" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2020/02/video-thumbnail-in-the-digital.png?fit=300%2C253&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Video Thumbnail | In The Digital" style="float: none; margin: auto;" decoding="async" loading="lazy" />Recently, I&#8217;ve had a couple of projects that require thumbnails for video posts. There are plugins out there to do this, but I wanted a simple, lightweight way. Good news is, this can be achieved very easily by making use of WordPress&#8217;s WP_Embed class. /** * Maybe get thumbnail from embed * * @param string [&#8230;]]]></description>
										<content:encoded><![CDATA[<img width="300" height="253" src="https://i1.wp.com/inthedigital.co.uk/wp-content/uploads/2020/02/video-thumbnail-in-the-digital.png?fit=300%2C253&amp;ssl=1" class="attachment-medium size-medium wp-post-image" alt="Video Thumbnail | In The Digital" style="float: none; margin: auto;" decoding="async" loading="lazy" /><p>Recently, I&#8217;ve had a couple of projects that require thumbnails for video posts. There are plugins out there to do this, but I wanted a simple, lightweight way. Good news is, this can be achieved very easily by making use of WordPress&#8217;s <code>WP_Embed</code> class.</p>
<pre><code class="lang-php">/**
 * Maybe get thumbnail from embed
 *
 * @param string $string
 * @return bool
 */
function get_embed_thumbnail_from_string_maybe ($string) {

    $found = preg_match_all(&#039;|^\s*(https?://[^\s&quot;]+)\s*$|im&#039;, $string, $matches);
    if (!$found) return false;

    // nb: this can be used if we&#039;re just checking an embed exists and is supported
    //foreach ($matches[1] as $match) if (wp_oembed_get($match)) return $match;

    $embed = new WP_oEmbed();
    foreach ($matches[1] as $match) {
        if ($embed-&gt;get_html($match)) {
            return $embed-&gt;get_data($match)-&gt;thumbnail_url;
        }
    }
    return false;
}</code></pre>
<p>Place the code above in a custom functionality class or, for a crude option, dump it in the <code>functions.php</code> file and call it when a thumbnail of the first video in a string is required. An obvious use case is the blog archive page when displaying thumbnails with each post link.</p>
<p>We develop custom WordPress solutions. If you have any advanced WordPress requirements, including custom themes, plugins or theme modifications, <a href="https://inthedigital.co.uk/contact-us/">please let us know</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1848</post-id>	</item>
	</channel>
</rss>
