Regex to remove URLs inside WordPress Post

There were time where I have to take down a web apps and making thousands of URL reference broken. So the only way to fix that is to remove all those links. Thankfully wordpress has a vast variety of regex search and replace.

I am using Search Regex plugins (You can find it on WP Plugins directory)

/<a href="http:\/\/www\.domain\.com\/subfolder\/[^>]*>([\s\S]*?)<\/a>/

Refer to the screenshot below.

Screen Shot 2016-06-20 at 2.16.49 PM

Placing an ad or content block on single post after certain paragraph – WordPress Tip

If you ever have to show an ad or content block on a single post page – under a certain paragraph (eg. right after the first paragraph) – you can use the code below by replacing the_content.

<?php
$ad_placement_p = 2;
$content = apply_filters('the_content', $post->post_content);if(substr_count($content, '<p>') > $ad_placement_p)
{
	$contents = explode("</p>", $content);
	$p_count = 1;
	foreach($contents as $content)
	{
		echo $content;
 
		if($p_count == $ad_placement_p)
		{
		?>
               Your Ad Code
		<?php
		}
		echo "</p>";
		$p_count++;
	}
}
?>

The way it works is by using < p > as marker of position. Feel free to change $ad_placement_p value to assign locations of this content/ad block.

How to setup pptp VPN server on Linux [Tutorial]

I’m moving to Japan very soon and remembered that Google Voice won’t be working once I step onto Land of the Rising Sun. So I figured I should setup a VPN tunneling for me to access services that is available only in the US. Setting up PPTPD is fairly easy and straight forward. I’m using SoftLayer BYOC (Build Your Own Cloud) which cost $70/month for 2TB bandwidth (inbound bandwidth is free – unlike Rackspace cloud).

Read More

Finding the right CDN for SlashGear

It has been interesting and educational two months; I had the chance to use several major CDN services on SlashGear. Choosing the right CDN is a matter of pricing/budget, delivery technology or features and POP availability. The CDN vendors I had the opportunity to try are MaxCDN, InterNAP, Highwinds, Akamai, and EdgeCast.

Read More

SlashGear is on WordPress Showcase

I’m honored that SlashGear was added to WordPress showcase for our unique implementation of WordPress & BBPress.

Quoted from WordPress Showcase

Why it’s in the Showcase: SlashGear is a major gadget and technology blog that receives millions of readers per month and uses WordPress to power its entire site, including main site, bbPress-powered forums, and video site. All three sites have integrated user tables and login session sharing.

Computer Hardware Upgrade – When is the right time?

Computers are everywhere. In fact, the life of many largely depends on computers. They send their mail on the web rather than the old time practice of sending them through snail mail. They talk to their friends through chats. Take up examinations digitally to prevent errors on checking. Life is surely easier because of them. But as much as we take advantage of these computers, we should be sensitive to their needs. Like any other machines, they also need to be upgraded from time to time to work better. We need to pave enough attention to this matter if we want to make the most out of them.

Read More