Problem:This is a common scenario. You are using tinyMCE in admin of a site to insert a link to image. While displaying that image on frontend tinyMCE makes it relative path instead of absolute.
When setting up tinyMCE set these 2 configuration options:
relative_urls : false
remove_script_host : false
Both these options are true by default. As the name implies, “remove_script_host” removes the protocol and host part of URLs. “relative_urls” must be set to false is you want to set “remove_script_host” to false.
TinyMCE documentation for relative_urls and remove_script_host.
Hope it helps.
In this post, we will see, how your can create your own sharing icons to share links on Facebook, Twitter and LinkedIn in a simple manner. Let us start now.
So I was working with the qTranslate plugin of WordPress’s and needed to select an image depending on language. qTranslate provides a utility function which returns the current language.
The function is called qtrans_getLanguage() and it works as follows:
$currentLang = qtrans_getLanguage();
if($currentLang == 'fr')
//show french logo
$imageName = logoFR.png';
else if($currentLang == 'hi')
//show Hindi logo
$imageName = logoHI.png';
//show english logo to rest
$imageName = logoEN.png';
You can find this function in qtranslate_utils.php file in qTranslate directory.
split function accepts a delimiter as first parameter, a string as second paramter and splits the string into an array by that delimiter. Returns original string if delimiter is not found.
Here is the code I used :
// id of the textbox is timeTaken
var strText = $.trim($('#timeTaken').val());
if(strText.split(' ').length > 1 )
console.log('no spaces please');