• Mr. Brightside

    She asked me ” Excuse me do i know you? “, to which i replied ” hi, i’m Mr. Brightside “, she smiled and said “well that’s tragic”, i mustered up a smile of my own and said ” I guess it is, guess it is” then i asked her “and might i know who it is that wants to know?” she just smiled turned and walked away. I’d have gone after her but the alarm clock shook me out of my dream, now i was fumbling around in my room trying to nullify the defining noise. It was all […]

    …Read More

  • Fire Fighters of Nepal

    All the festivities were over, we spent the day laughing, having fun, playing cards and now it was time for rest like every other tika in every other dashain. But today would not be just another tika. I heard the first screams around ten, I ignored them : i’d seen men drink the whole day, it wasn’t a surprise that they’d get into fights: nothing out of the norm. However these screams weren’t the usual screams, the usual would be cries of men screaming obscenities at each other. No these were the screams of men, women and children: these were […]

    …Read More

  • The Value of Information

    After 4 years of being an IT student it is ironic that this will be my first article regarding my field of choice. Yet I feel the time is right to write and share. What does it mean to be an IT student? Many of aspire to be the next Zucherberg or Bill Gates, most of us are dreamers. Dreamers that believe an idea can change the world. After all those stories of kids out of college that make it big are the norm in the IT sector. The Entrepreneurial spirit, that’s what they give us! The field of IT […]

    …Read More

  • Custom Post Type with Custom Meta Boxes Part 1 of 2

    First lets start with registering a custom post type, to be used at our discretion.There are 5 basic post_types that comes with wordpress these are not to be messed with. They are : Post (Post Type: ‘post’) Page (Post Type: ‘page’) Attachment (Post Type: ‘attachment’) Revision (Post Type: ‘revision’) Navigation menu (Post Type: ‘nav_menu_item’) If you use woocommerce you’ll see that basically they also use post_types. For now lets go with something easy. So the best(simplest) example that i could think of is with a custom photo gallery: You set your featured image there and add text there and it […]

    …Read More

  • WordPress Backend: Add Custom Field to Users Page

    So this is to add a custom field to your wordpress users page on the admin side. For well a plethora of things come to mind, if you want to show custom usermeta and make them editatble on the back end i’m guessing this would be pretty useful no? Ok the first part the function digthis_add_custom_fields just basically outputs the form and everything else required to show your field on the back end. <?php function digthis_add_custom_fields( $user ) {?> <h3><?php _e(‘Maintenance’, ‘twentythirteen’); ?></h3> <table class=”form-table”> <tr> <th> <label for=””><?php _e(‘Digthis Custom Field’, ‘twentythirteen’); ?> </label></th> <td> <input id=”my_id’  type=’text’ name=”fbname” […]

    …Read More

  • How to set up a virtual host on WAMP server

    Step 1: C:\Windows\system32\drivers\etc\hosts # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted […]

    …Read More

  • WordPress: Making Ajax Calls

    Just Like i promised, today we will cover making Ajax Calls Well lets start with the basics shall we? Each request needs to supply at least one piece of data (using the GET or POST method) called action. Based on this action, the code in admin-ajax.php creates two hooks, wp_ajax_my_action and wp_ajax_nopriv_my_action, wheremy_action is the value of the GET or POST variable action. Adding a function to the first hook means that that function will fire if a logged-in user initiates the action. Using the second hook, you can cater to logged-out users separately. add_action( ‘wp_enqueue_scripts’, ‘my_script_enqueuer’ ); function my_script_enqueuer() […]

    …Read More

  • Sync Roles of Multisite Users

    So this happened at work today, was working on a multiste and the client required that under a certain condition. For now lets say the condition is that I’m subscribing to the site and for 5 days i’m a free user on the 5th day i need the client to revert to role => unpaid. In my functions.php file i have this code function mysite_sync_site_roles($user_id = NULL) { // is_multisite() used just as precaution, this code is meant to Multisite only if( !is_multisite()) return; // Initial data $user_info = get_userdata( $user_id ); if(in_array(‘administrator’, $user_info->roles)) return; $blogs = get_blogs_of_user( $user_id ); […]

    …Read More

  • Understanding The WordPress Template Hierarchy

    Template Hierarchy: 1)      Which template files will WordPress use when it displays a certain type of page? The General Idea WordPress uses the Query String — information contained within each link on your web site — to decide which template or set of templates will be used to display the page. First, WordPress matches every Query String to query types — i.e. it decides what type of page (a search page, a category page, the home page etc.) is being requested. Example https://www.digamberpradhan.com.np/?s=asdf this hyperlink will result in a  search page. Templates are then chosen — and web page content is generated […]

    …Read More

  • How to use PHP Data in your Javascript files for WordPress

    WordPress makes it spectacularly easy to transfer data to you javascript files if you’re unfamiliar with enqueuing scripts then please refer to my previous post. Here it goes then. Say you want to do something “fancy” like ajax calls from you js files. I’m starting to get a little off point here right now i’d like to fully explore only localization. So ajax calls will be covered in a later post (hopefully soon) You’ll need to use wp_localize_script to make data availabe to javascript. Syntax: wp_localize_script( $handle, $name, $data ); Example add_action(‘wp_enqueue_scripts’,’digthis_loadscript’); function digthis_loadscript() { wp_register_script( ‘main’, get_template_directory_uri(). ‘/js/main.js’, ”, […]

    …Read More