Showing posts with label Wordpress. Show all posts
Showing posts with label Wordpress. Show all posts

Wednesday 28 August 2019

How to Eliminate render-blocking JavaScript and CSS on WordPress

https://www.hostinger.in/tutorials/how-to-fix-eliminate-render-blocking-javascript-and-css-in-above-the-fold-content-on-wordpress

Saturday 8 June 2019

How to add Language of custom plugin in Admin dashboard in wordpress



Add text for language like this "<?php echo __('General options', 'roomle'); ?>"

Step 1 : Create plugin like "roomle"
Step 2 : Set domain path into plugin file like following screenshot

Step 3 : Create "roomle.pot" inside /wp-content/plugins/roomle/languages/
Step 4 : Add like following text inside "roomle.pot" file (FYI : Don't add any translation language just add as (msgstr = ""))
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-06-08 12:08+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: functions.php:29
#, php-format
msgid "Roomle"
msgstr ""
#: functions.php:47
#, php-format
msgid "Select"
msgstr ""
#: functions.php:56
msgid "Roomle product type"
msgstr ""
Step 5 : Download the free plugin called Loco Translate from here. Or add directly from the WordPress administration via Plugins > Add New. (https://wordpress.org/plugins/loco-translate/)
Step 6 : Install and Activate Loco plugin
Step 7 : Click on Plugin inner menu of Loco after that click into your plugin from list.

Step 8 : Click on New language
Step 9 : Choose a language which you wish to translate (Here translate from English to Spanish)

Step 10 : See Source text (its from "roomle.pot" ) you need to add text of translate language.

Step 11 : After create all text to Spanish language, Check "/roomle/wp-content/languages/plugins/" directory. your 2 file is created here like "roomle-es_ES.mo" and "roomle-es_ES.po"
Step 12 : If you wish to check so you need to download wordpress in spanish language and setup wordpress and check

Also this answer for following question

  • How to Change the Admin plugin Language
  • How to add language into your plugin
  • How to add language into your custom plugin

Wednesday 4 May 2016

Convert PHP, Magento, Joomla, Codeigniter, Cake PHP, Wordpress XML to JSON, XML to Array, JSON to Array

Convert PHP, Magento, Joomla, Codeigniter, Cake PHP, Wordpress XML to JSON, XML to Array, JSON to Array is very difficult task for some people. But, in PHP, believe me it’s very easy. One line of code each! Don’t believe? Just check out the code below and test it yourself!


$xml = simplexml_load_string($xmldata);
$json = json_encode($xml);
$array = json_decode($json,true);

Thursday 11 February 2016

How to display product option/variant in category page in woocommerce wordpress

<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_rating - 5
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
</a>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
with this:
<?php
/**
* ADD PRODUCT VARIABLE WITH ADD TO CART ON CATALOG PAGE
ADDED BY GW
**/
?>
<div class="catbox">
<?php
//ADD SHORT DESCRIPTION TO PRODUCT
add_action('woocommerce_after_shop_loop_item_title','woocommerce_template_single_excerpt', 5); ?>
<?php
/**
* woocommerce_after_shop_loop_item_title hook
*
* @hooked woocommerce_template_loop_rating - 5
* @hooked woocommerce_template_loop_price - 10
*/
do_action( 'woocommerce_after_shop_loop_item_title' );
?>
<?php do_action( 'woocommerce_after_shop_loop_item' ); ?>
<?php
//ADD VARIATIONS BEFORE ADD TO CART
if($product->product_type == "variable"){
woocommerce_variable_add_to_cart();
} else {
woocommerce_template_loop_add_to_cart();
}
?>
</div>

Thursday 27 August 2015

Redirect all urls exactly, just change domain name

How to change domain using htaccess file

Many times we have a in CMS and Ecommerce website to change the domain due to maintenance or other reason but the main headache is the suburl (categories or collection) should be work as it is other wise we need to write the 301 url redirect for each and every url to not get the SEO errors.
This is tutorial will be help for the following CMS :
  1. wordpress development
  2. Joomal development
  3. Drupal development
There are Ecommerce platform that get help from this
  1. Magento development
  2. Opencart development
  3. Woocommerce
  4. Virtumart
So here is the simple and easy option that will work using the add the few lines in the htaccess file (if file not available create it .htaccess).


RewriteEngine On

RewriteCond %{HTTP_HOST} ^(?:www\.)domain\.com$ [NC]
RewriteRule ^ http://newdomain.com%{REQUEST_URI} [L,R=301]