Saturday, April 12, 2014

How to add menu in Wordpress Admin without Plugin

Here we are talking about Adding a menu item in wordpress admin panel to add manual functionality for your themes and plugins etc. Let's do it You need a Wordpress Function called add_action which get 2 parameter. 
add_action Parameters Explanations:
  1.  First parameter is what do you want to add so we write admin menu.
  2. Second parameter is that we will tell wordpress add action that my other explanation will be in signal_adder function
what will be in signal_adder function

We write function signal_adder(){

==>now our add_action will complete after this function  

we are telling wordpress in next line add_posts_page it means our menu item will be in posts section just copy the code and paste in theme functions.php file and you will see there is a menu called Add Signal.

add_posts_page parameter Explanations
  1. First parameter will be the Menu Title 
  2. Second parameter will be the Page Title 
  3. Third parameter will be manage our page options (Fixed just write as it is)
  4. fourth parameter will be your choice because in our admin panel url will be 
  5. Fifth parameter will be a function in which our other things lie like what will be the page matter or texts etc. 


function signal_adder(){
    add_posts_page('Add Signal','Add Signal','manage_options','signali','signal_adder_text');
function signal_adder_text(){
    echo "Hurrah i make a custom admin menu";

Beginners always feel very ambiguous while making admin menu just write i will comment and solve your problem as already i am beginner not an expert but the problems i tackle i write here. Just follow the path and you will be lead by me. Hope you will like this tutorial then you going to share and comment your review thanks for reading.

How to get Default Timezone in PHP

Here i will talk about timezone which you can't get in PHP there is no built in function to get that.... But here i am with a new technique to get timezone in PHP using Javascript. Let's do it.

First of all Download a small js file from top of this website. Put this file in js folder and replace the name here bold in code

function timeStamp(){
    echo '<script type="text/javascript" src="'js/jstie.min.js" /></script>';
    echo '<script type="text/javascript">';
    echo "var timezone = jstz.determine();";

    $timezoni = "document.write(;";
    echo "</script>"; 


That's all now your timezone will be save in variable $timezoni nothing difficult just call the function timeStamp();  you will get a variable timezoni and put that in date_default_timezone_set() this is the PHP function to set a specific timezone but we do it dynamically.

Hope you will like this tutorial and you going to comment and share this with your friend.