Thursday, April 17, 2014
Wednesday, April 16, 2014
How to change add to cart text in woocommerce
For Single product page
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Add this below code to your theme functions.php file
//for < 2.1
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' );
// for 2.1 +
add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' );
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
For Product Category Page
Add this below code to your functions.php file
add_filter( 'add_to_cart_text', 'woo_custom_cart_button_text' ); // for < 2.1
add_filter( 'woocommerce_product_add_to_cart_text', 'woo_custom_cart_button_text' ); // for 2.1 +
function woo_custom_cart_button_text() {
return __( 'My Button Text', 'woocommerce' );
}
Monday, April 14, 2014
Add option for duplicate post in wordpress without plugins
Some time we need an option duplicate post/page in wordpress
Add this code in your functions.php file
/*
* Function creates post duplicate as a draft and redirects then to the edit post screen
*/
function rd_duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');
}
/*
* get the original post id
*/
$post_id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
/*
* and all the original post data then
*/
$post = get_post( $post_id );
/*
* if you don't want current user to be the new post author,
* then change next couple of lines to this: $new_post_author = $post->post_author;
*/
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/*
* if post data exists, create the post duplicate
*/
if (isset( $post ) && $post != null) {
/*
* new post data array
*/
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => 'draft',
'post_title' => $post->post_title,
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order
);
/*
* insert the post by wp_insert_post() function
*/
$new_post_id = wp_insert_post( $args );
/*
* get all current post terms ad set them to the new post draft
*/
$taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
}
/*
* duplicate all post meta
*/
$post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
if (count($post_meta_infos)!=0) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
foreach ($post_meta_infos as $meta_info) {
$meta_key = $meta_info->meta_key;
$meta_value = addslashes($meta_info->meta_value);
$sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
}
$sql_query.= implode(" UNION ALL ", $sql_query_sel);
$wpdb->query($sql_query);
}
/*
* finally, redirect to the edit post screen for the new draft
*/
wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
exit;
} else {
wp_die('Post creation failed, could not find original post: ' . $post_id);
}
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
/*
* Add the duplicate link to action list for post_row_actions
*/
function rd_duplicate_post_link( $actions, $post ) {
if (current_user_can('edit_posts')) {
$actions['duplicate'] = '<a href="admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
}
return $actions;
}
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
If you want do set it only for specific post type then only red color code by bellow code
add_filter('{post type name}_row_actions', 'rd_duplicate_post_link', 10, 2);
Add this code in your functions.php file
/*
* Function creates post duplicate as a draft and redirects then to the edit post screen
*/
function rd_duplicate_post_as_draft(){
global $wpdb;
if (! ( isset( $_GET['post']) || isset( $_POST['post']) || ( isset($_REQUEST['action']) && 'rd_duplicate_post_as_draft' == $_REQUEST['action'] ) ) ) {
wp_die('No post to duplicate has been supplied!');
}
/*
* get the original post id
*/
$post_id = (isset($_GET['post']) ? $_GET['post'] : $_POST['post']);
/*
* and all the original post data then
*/
$post = get_post( $post_id );
/*
* if you don't want current user to be the new post author,
* then change next couple of lines to this: $new_post_author = $post->post_author;
*/
$current_user = wp_get_current_user();
$new_post_author = $current_user->ID;
/*
* if post data exists, create the post duplicate
*/
if (isset( $post ) && $post != null) {
/*
* new post data array
*/
$args = array(
'comment_status' => $post->comment_status,
'ping_status' => $post->ping_status,
'post_author' => $new_post_author,
'post_content' => $post->post_content,
'post_excerpt' => $post->post_excerpt,
'post_name' => $post->post_name,
'post_parent' => $post->post_parent,
'post_password' => $post->post_password,
'post_status' => 'draft',
'post_title' => $post->post_title,
'post_type' => $post->post_type,
'to_ping' => $post->to_ping,
'menu_order' => $post->menu_order
);
/*
* insert the post by wp_insert_post() function
*/
$new_post_id = wp_insert_post( $args );
/*
* get all current post terms ad set them to the new post draft
*/
$taxonomies = get_object_taxonomies($post->post_type); // returns array of taxonomy names for post type, ex array("category", "post_tag");
foreach ($taxonomies as $taxonomy) {
$post_terms = wp_get_object_terms($post_id, $taxonomy, array('fields' => 'slugs'));
wp_set_object_terms($new_post_id, $post_terms, $taxonomy, false);
}
/*
* duplicate all post meta
*/
$post_meta_infos = $wpdb->get_results("SELECT meta_key, meta_value FROM $wpdb->postmeta WHERE post_id=$post_id");
if (count($post_meta_infos)!=0) {
$sql_query = "INSERT INTO $wpdb->postmeta (post_id, meta_key, meta_value) ";
foreach ($post_meta_infos as $meta_info) {
$meta_key = $meta_info->meta_key;
$meta_value = addslashes($meta_info->meta_value);
$sql_query_sel[]= "SELECT $new_post_id, '$meta_key', '$meta_value'";
}
$sql_query.= implode(" UNION ALL ", $sql_query_sel);
$wpdb->query($sql_query);
}
/*
* finally, redirect to the edit post screen for the new draft
*/
wp_redirect( admin_url( 'post.php?action=edit&post=' . $new_post_id ) );
exit;
} else {
wp_die('Post creation failed, could not find original post: ' . $post_id);
}
}
add_action( 'admin_action_rd_duplicate_post_as_draft', 'rd_duplicate_post_as_draft' );
/*
* Add the duplicate link to action list for post_row_actions
*/
function rd_duplicate_post_link( $actions, $post ) {
if (current_user_can('edit_posts')) {
$actions['duplicate'] = '<a href="admin.php?action=rd_duplicate_post_as_draft&post=' . $post->ID . '" title="Duplicate this item" rel="permalink">Duplicate</a>';
}
return $actions;
}
add_filter( 'post_row_actions', 'rd_duplicate_post_link', 10, 2 );
If you want do set it only for specific post type then only red color code by bellow code
add_filter('{post type name}_row_actions', 'rd_duplicate_post_link', 10, 2);
Monday, February 3, 2014
Using PayPal From Bangladesh and send money from paypal to payoneer
Using PayPal From Bangladesh
How to do it:
01. Apply for a Payoneer card (http://share.payoneer-affiliates.com/a/clk/1KWC9X). If you are a freelancer at oDesk or Elance, affiliated with the companies that support Payoneer as their payment method then this thing will get easy. Even if you are a blogger and using ads from infolinks or textlinkads you can apply for the card easily inside from your account.
02. Once you have the card now you’ll need some money loaded into it. As mentioned earlier- if you are a freelancer than you can earn some money and load it into your payoneer card.
03. Before opening a PayPal account you must know that you can’t add Bangladesh as your country. So, you’ll need someone who lives in any of the PayPal accepted country. It’s better if he/she is your relative. Ask them if they can help you in this regard. Open a PayPal account in your name and with your e-mail address, but for physical address or location use their address and country. PayPal may (I know they will) send papers for approval in that address. Tell them to forward those in your address.
04. Now add your payoneer debit master card in your PayPal. Verify it as instructed there. Don’t forget to have at least $5 balance in the card. Once you have it verified you can spend money with your PayPal. The amount will be cut from you Payoneer card.
But wait, there are more to go. You can spend money with your newly activated paypal account but you can’t receive money with that account. There is another step to achieve that too.
05. If you have a good transaction they will provide you with a US bank account number and routing number in your name. Now- use this account to add a bank account in the paypal. Verify the bank account also as instructed in the PayPal.
You can get that information from your Payoneer account
Receive Money --> US Payment Profile
https://myaccount.payoneer.com/MainPage/USPProfile.aspx
How to do it:
01. Apply for a Payoneer card (http://share.payoneer-affiliates.com/a/clk/1KWC9X). If you are a freelancer at oDesk or Elance, affiliated with the companies that support Payoneer as their payment method then this thing will get easy. Even if you are a blogger and using ads from infolinks or textlinkads you can apply for the card easily inside from your account.
02. Once you have the card now you’ll need some money loaded into it. As mentioned earlier- if you are a freelancer than you can earn some money and load it into your payoneer card.
03. Before opening a PayPal account you must know that you can’t add Bangladesh as your country. So, you’ll need someone who lives in any of the PayPal accepted country. It’s better if he/she is your relative. Ask them if they can help you in this regard. Open a PayPal account in your name and with your e-mail address, but for physical address or location use their address and country. PayPal may (I know they will) send papers for approval in that address. Tell them to forward those in your address.
04. Now add your payoneer debit master card in your PayPal. Verify it as instructed there. Don’t forget to have at least $5 balance in the card. Once you have it verified you can spend money with your PayPal. The amount will be cut from you Payoneer card.
But wait, there are more to go. You can spend money with your newly activated paypal account but you can’t receive money with that account. There is another step to achieve that too.
05. If you have a good transaction they will provide you with a US bank account number and routing number in your name. Now- use this account to add a bank account in the paypal. Verify the bank account also as instructed in the PayPal.
You can get that information from your Payoneer account
Receive Money --> US Payment Profile
https://myaccount.payoneer.com/MainPage/USPProfile.aspx
Sunday, October 20, 2013
How to Creating a PayPal Sandbox Test Account
The first thing you need to do is to login to the PayPal developer website: http://developer.paypal.com
Use your existing PayPal username and password to login. Once logged in you’ll arrive at the Dashboard. Navigate to Applications → Sandbox accounts
Now we’ll need to create 2 test accounts – 1 for the merchant (representing your shop’s PayPal account) and 1 for a buyer (representing a customer).
On your website:
Select checkbox: Enable PayPal standard
Use the merchant test account email you created above for the PayPal & Receiver email
Select checkbox: Enable PayPal sandbox
Difference Between PayPal Express Checkout and Website Payments Standard?
If you use PayPal Express Checkout, when your customers check out, they will be directed to a page that requires them to log into their PayPal account or create a new one. Therefore, this is the best option if you anticipate that most of your customers either have a PayPal account or will sign up for an account on checkout.
It may also improve sales; according to PayPal’s website, the Express Checkout button "can increase sales by 14% on average*" and has "conversion rates [that] are 23% higher than standard checkout at some of today's largest online retailers.**"
If you use PayPal Website Payments Standard, when your customers check out, they will be directed to a page that allows them to log into their PayPal account or pay by credit card without having to sign up for a PayPal account. This is the best option if you anticipate that most of your customers will not want to sign up for a PayPal account.
Which is best for me?
PayPal Website Payments Standard allows users the choice of signing in or not signing in, and can be considered the default choice; PayPal Express Checkout can be more efficient for PayPal users and may facilitate sales.
It may depend on whether or not you also have a credit card processing option; if you do, you can use PayPal Express Checkout, since the customer will only need to use this option to pay with PayPal funds. If PayPal is your only payment method, you may want to use PayPal Website Payments Standard so that your customers have the option of using a credit card.
Why can't I use both options with Shopping Cart Creator?
If you try to enable both options in the Payment section of Shopping Cart Creator, you will get a warning message that says "Only one PayPal payment method can be used," which will then prompt you to disable one of these methods. Since one method requires that users sign in to PayPal and the other doesn't require users to sign in to PayPal, they contradict each other. Consequently, you can only use one method or the other.
It may also improve sales; according to PayPal’s website, the Express Checkout button "can increase sales by 14% on average*" and has "conversion rates [that] are 23% higher than standard checkout at some of today's largest online retailers.**"
If you use PayPal Website Payments Standard, when your customers check out, they will be directed to a page that allows them to log into their PayPal account or pay by credit card without having to sign up for a PayPal account. This is the best option if you anticipate that most of your customers will not want to sign up for a PayPal account.
Which is best for me?
PayPal Website Payments Standard allows users the choice of signing in or not signing in, and can be considered the default choice; PayPal Express Checkout can be more efficient for PayPal users and may facilitate sales.
It may depend on whether or not you also have a credit card processing option; if you do, you can use PayPal Express Checkout, since the customer will only need to use this option to pay with PayPal funds. If PayPal is your only payment method, you may want to use PayPal Website Payments Standard so that your customers have the option of using a credit card.
Why can't I use both options with Shopping Cart Creator?
If you try to enable both options in the Payment section of Shopping Cart Creator, you will get a warning message that says "Only one PayPal payment method can be used," which will then prompt you to disable one of these methods. Since one method requires that users sign in to PayPal and the other doesn't require users to sign in to PayPal, they contradict each other. Consequently, you can only use one method or the other.
Tuesday, October 1, 2013
How to make website content copy protected
Watermark Your Photos
Add watermark on your images. You can use this website http://picmarkr.com/ for adding watermark on images for your website.
Disable the Right Click Function:
It is another way to protect your content to copy by right click.
Use this below code between <body> tag of your website
<script language=JavaScript>
<!--
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
By using Tynt.com
Go to Tynt.com Create an account here. Click on get the code.This is a tool that automatically produces a backlink right to your site when an individual steals your web content. The back links give you the authority and page rank so you can get the top result in the search engines. This will create more web traffic to your site so you can get paid for the content you wrote.
Add watermark on your images. You can use this website http://picmarkr.com/ for adding watermark on images for your website.
Disable the Right Click Function:
It is another way to protect your content to copy by right click.
Use this below code between <body> tag of your website
<script language=JavaScript>
<!--
var message="Function Disabled!";
///////////////////////////////////
function clickIE4(){
if (event.button==2){
alert(message);
return false;
}
}
function clickNS4(e){
if (document.layers||document.getElementById&&!document.all){
if (e.which==2||e.which==3){
alert(message);
return false;
}
}
}
if (document.layers){
document.captureEvents(Event.MOUSEDOWN);
document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("alert(message);return false")
// -->
</script>
By using Tynt.com
Go to Tynt.com Create an account here. Click on get the code.This is a tool that automatically produces a backlink right to your site when an individual steals your web content. The back links give you the authority and page rank so you can get the top result in the search engines. This will create more web traffic to your site so you can get paid for the content you wrote.
Subscribe to:
Posts (Atom)
-
1. Download owl-carousel from http://owlgraphic.com/owlcarousel/ 2. Collect files from zip folder · AjaxLoader...
-
Step 1: At first close Xamp. Browse and open the following 3 files C:\Program Files\xampp\apache\bin\php.ini C:\Program Files\xampp\ph...
-
Here, I tried to show how to override WooCommerce Price Filter widget. At first Add this below code to your functions.php file. copy the...

