VBlog

Category: WordPress

All you ever wanted to know about WordPress hosting cleverly summed up in a superb infography. Courtesy of CodeinWP.com.

Continue reading

Responsive Videos in WordPress Posts

Here’s a small jQuery code snippet that I found on Anders Noréen‘s themes that makes sure embeded videos have the correct size ratio on any screen.

(function() {
    // resize videos after container
	var vidSelector = "iframe, object, video";
	var resizeVideo = function(sSel) {
		$( sSel ).each(function() {
			var $video = $(this),
				$container = $video.parent(),
				iTargetWidth = $container.width();

			if ( !$video.attr("data-origwidth") ) {
				$video.attr("data-origwidth", $video.attr("width"));
				$video.attr("data-origheight", $video.attr("height"));
			}

			var ratio = iTargetWidth / $video.attr("data-origwidth");

			$video.css("width", iTargetWidth + "px");
			$video.css("height", ( $video.attr("data-origheight") * ratio ) + "px");
		});
	};

	resizeVideo(vidSelector);

	$(window).resize(function() {
		resizeVideo(vidSelector);
	});
})();

Change WordPress Language on a Running Install

Well I thought it would be tough but it’s actually pretty simple, or even a one line change if you want to switch back to English. To do the latter, simple open your wp-config.php file, find the WPLANG constant, and empty it. Period.

define('WPLANG', '');

Now if you need to switch to another language than English, you will need to grab the language files on the WordPress Language File Repository, and upload them to your install before modifying the wp-config.php file.

To do so, go to the repository, chose the desired language (for examplefr_FR), click the branches link, pick the version of your WP install, and open the messages repertory. Download all the files you see, and upload them to the wp-content/languages repertory on your server. Now you can edit your wp-config.php file and change the WPLANG value to the language code you picked (in my case fr_FR).

define('WPLANG', 'fr_FR');

That’s it. :)

Copyright © 2018 VBlog

Theme by Anders NorenUp ↑