Skip to content

Instantly share code, notes, and snippets.

View dasbairagya's full-sized avatar
🎯
Focusing

Gopal Dasbariagya dasbairagya

🎯
Focusing
View GitHub Profile
Seller Account Details:
[email protected]
Apnapakistan1
Main Admin Details:
admin
Apnapakistan1
@dasbairagya
dasbairagya / plugin-file.php
Created October 27, 2018 09:56
Replace the textarea field with wordpress default editor.
<!-- <textarea name="general_info" class="form-control rounded-0" id="exampleFormControlTextarea2" rows="3"><?php echo get_user_meta($current_user->ID,'general_info', true);?></textarea> -->
<?php
$content = get_user_meta($current_user->ID,'general_info', true);
$editor_id = 'general_info';//here editor is the name field of textarea
wp_editor( $content, $editor_id );
?>
@dasbairagya
dasbairagya / index.html
Created September 18, 2018 09:45
live-pro
http://indiatribune.com/
http://www.spacesharings.com/
http://www.serenitea.com.au/
http://www.egates.com.au/
http://www.lvlightings.com/
http://isavedasoul.com/
@dasbairagya
dasbairagya / functions.php
Created September 18, 2018 07:33
Automatically create page and assign a page template to it....
<?php
$awesome_page_id = get_option("awesome_page_id");
if (!$awesome_page_id) {
//create a new page and automatically assign the page template
$post1 = array(
'post_title' => 'Awesome Page!',
'post_content' => "",
'post_status' => "publish",
'post_type' => 'page',
);
@dasbairagya
dasbairagya / functions.php
Created August 25, 2018 11:36
Create meta-box to fetch all the cities from the database
<?php
/**
* Register meta box(es).
*/
add_action( 'add_meta_boxes', 'city_register_meta_boxes' );
function city_register_meta_boxes() {
$post_type = get_post_type();
add_meta_box( 'city', 'City', 'city_display_callback', $post_type, "side", "low", 'default');
}
function city_display_callback($post){
@dasbairagya
dasbairagya / functions.php
Created August 8, 2018 18:30
Woocommerce customization through hook
<?php
// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-Woocommerce Customization-=-=-=-=-=-=-=-=-=-=-=
// @customization files: followed by .php
# wc>loop>rating
# wc>loop>price
# wc>loop>add-to-cart
# wc>content-product
# wc>content-single-product
# wc>archive-product
# wc>single-product>add-to-cart>variation-add-to-cart-button
@dasbairagya
dasbairagya / profile.php
Created July 31, 2018 09:54
Multiple gallery upload to the user meta
<?php
$current_user = wp_get_current_user();
$img = get_user_meta($current_user->ID,'picture', true);
$certificates = get_user_meta( $current_user->ID,'certificates', false);
$cityies = get_user_meta($current_user->ID,'city', false);
$city_array = $cityies[0];
$suburbs = get_user_meta($current_user->ID,'suburb', true);
$suburb_array = explode(',',$suburbs);
/*Required for file uploading*/
@dasbairagya
dasbairagya / form.php
Last active July 31, 2018 09:51
Multiple attachement sending using wp mail...
<?php
if(isset($_POST['submit'])){
$fname = $_POST['fname'];
$lname= $_POST['lname'];
$phonenumber= $_POST['phonenumber'];
$email= $_POST['email'];
$enquiry=$_POST['enquiry'];
$fullname= $fname. ' '.$lname;
function my_custom_email_content_type( $content_type ) {
return 'text/html';
@dasbairagya
dasbairagya / disable.js
Last active October 22, 2018 18:59
Script to disable the right click and inspect elemt of any browser :
$(document).keydown(function(e) {
return 123 == e.keyCode ? !1 : e.ctrlKey && e.shiftKey && 73 == e.keyCode ? !1 : void 0
}), document.addEventListener("contextmenu", function(e) {
e.preventDefault()
}), document.onkeydown = function(e) {
return !e.ctrlKey || 67 !== e.keyCode && 86 !== e.keyCode && 85 !== e.keyCode && 117 !== e.keyCode ? !0 : !1
}, $(document).keypress("u", function(e) {
return e.ctrlKey ? !1 : !0
});
@dasbairagya
dasbairagya / functions.php
Last active June 11, 2018 09:28
Wordpress tab base profile page
<?php
// ajax remove attachement
add_action( 'wp_ajax_delete_attachment', 'delete_attachment' );
function delete_attachment( $post ) {
$attached_id = $_POST['att_ID'];
$user_id = get_current_user_id();
$certificates = get_user_meta( $user_id,'certificates', false);
$index_value = array_search($attached_id, $certificates[0]);
$msg = 'Attachment has been deleted successfully!';
if( wp_delete_attachment( $_POST['att_ID'], true )) {