Wednesday, May 21, 2014
Saturday, May 17, 2014
Making a Instructor (WPLMS)
How an Administrator can create an Instructor by changing the user role of a registered user from student to Instructor.
Certificate Templates : Creating and Connecting (for WPLMS)
This video help you to create Certificate Templates. Also, after creating template you can connect this to your course.
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
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...

