31 August 2019

How to use time and date function in php with indian timezone?

Use time and date function in php with indian timezone



<?php

if(function_exists('date_default_timezone_set')) {
    date_default_timezone_set("Asia/Kolkata");
}

// then use the date functions, not the other way around
$date = date("d/m/Y");
$date1 =  date("H:i a");

echo $date . '<br/>';
echo $date1;

?>

27 August 2019

How to assign variables in php with for loop?

assign variables in php with for loop
for($i = 0; $i <= 7; $i++) {
     $name = "variable{$i}";
     $$name = "foo";
}
or
for($i = 0; $i <= 7; $i++) {
     ${"variable$i"} = "foo";
}
or
${"jassi"} .= $_POST['skip'.$daynum];

23 August 2019

How to insert time and date in database when user login on site(login tracking)?

login tracking


 if(function_exists('date_default_timezone_set')) {
date_default_timezone_set("Asia/Kolkata");
}

$date = date("d/m/Y");
$time =  date("H:i a");
global $wpdb;
$table_name = $wpdb->prefix . "logintime";
$wpdb->insert($table_name, array('start_time' => $date, 'login_date' => $time) );

21 August 2019

How to get(search) record in table with ajax via dropdown?


get(search) record in table with ajax via dropdown
Use in main file which you will create 


<script src="<?php echo plugin_dir_url(__FILE__);?>/js/jquery.min.js"></script>
<script>



jQuery(document).ready(function($){
$(".selectcustomer").change(function(){
var name = $(".selectcustomer").val();

/* alert(name); */
var data = {
'action' : 'showdata',
'custname' : name,
};
var ajaxurl = $(".ajaxurl").val();
jQuery.post(ajaxurl, data, function(response) {

console.log(response);
$(".customer-info").html(response);

});
});
});
</script>




<body>
<div class="wrapper">
<div class="wrap">
<form action="" method="post">
<div class="col-3">
<label>Customer Name</label>
<select class="selectcustomer" name="custname">
<option>Select Name</option>
<?php
global $wpdb;

$result = $wpdb->get_results ( "SELECT * FROM wp_jaspreetsingh" );
foreach ( $result as $printr ) 
{
echo"<option>$printr->person_name</option>";

}
?>
</select>
</div>
<div class="customer-info">
<div class="col-3">
<label>Customer Address</label>
<input type="text" name="customeraddress" placeholder="Customer Address" value="">
</div>
<div class="col-3">
<label>Contact Person</label>
<input type="text" name="contactperson" placeholder="Contact Person" >
</div>
<div class="col-3">
<label>Customer Email</label>
<input type="Email" name="email" placeholder="Email" value="">
</div>
<div class="col-3">
<label>Phone</label>
<input type="number" name="phone" placeholder="Phone" value="" >
</div>
</div>

</form>
</div>
</div>
<body>




         Use in function.php file which is located in theme folder.

function showdata(){
$name=$_POST['custname'];
   



        global $wpdb;
        $result = $wpdb->get_results ( "SELECT * FROM wp_jaspreetsingh where person_name='$name' " );
        foreach ( $result as $printr )   {
         
            }
      ?>

<div class="customer-info">
<div class="col-3">
<label>Customer Address</label>
<input type="text" name="customeraddress" placeholder="Customer Address" value="<?Php echo $printr->address; ?>">
</div>
<div class="col-3">
<label>Contact Person</label>
<input type="text" name="contactperson" placeholder="Contact Person" >
</div>
<div class="col-3">
<label>Customer Email</label>
<input type="Email" name="email" placeholder="Email" value="<?Php echo $printr->email; ?>">
</div>
<div class="col-3">
<label>Phone</label>
<input type="number" name="phone" placeholder="Phone" value="<?Php echo $printr->phone; ?>" >
</div>
</div>


<?php
die();

}
add_action('wp_ajax_showdata','showdata');
add_action('wp_ajax_nopriv_showdata','showdata');


How to use properly ajax in wordpress ?

                          use ajax in wordpress 

            Use in main.php file which you will create

<html>
<head>
<script src="<?php echo plugin_dir_url(__FILE__);?>/js/jquery.min.js"></script>
<script>
jQuery(document).ready(function($){
$(".select").change(function(){
var name = $(".select").val();

alert(name);
var data = {
'action' : 'showdata',
'name' : name,
};
var ajaxurl = $(".ajaxurl").val();
jQuery.post(ajaxurl, data, function(response) {

console.log(response);
$(".result").val(response);

});
});
});

</script>

<style>
.wrap{

width:80%;
margin:auto;

}

</style>
<head>
<body>
<div class="wrap">
<select class="select" >
<option value="jaspreet">jaspreet</option>
<option value="Developer">Developer</option>
<option value="Hello">Hello</option>
</select>
<div class="demo"></div>
<input type="hidden" class="ajaxurl" value="<?php echo admin_url('admin-ajax.php');?>">
<input type="text" class="result">
</div>
</body>
</html>




Use in function.php file which is located in --------->>>>>>>>>> C:\wamp64\www\home\wp-content\themes\twentynineteen





function showdata(){
$name=$_POST['name'];
echo "hello"." ".$name;
die();
}
add_action('wp_ajax_showdata','showdata');
add_action('wp_ajax_nopriv_showdata','showdata');

19 August 2019

How to add options in select html tag(Drowdown) from database in wordpress?

add options in select html tag(Drowdown) from database in wordpress


<label>Customer Name</label>
<select>
<?php
global $wpdb;

$result = $wpdb->get_results ( "SELECT * FROM wp_jaspreetsingh " );
foreach ( $result as $print ) 
{
echo"<option>$print->person_name</option>";
}
?>
</select>

How to create options is select html tag(drpopdown) in php?

create options is select html tag(drpopdown) in php


<select>
<?php

for($i=1;$i<=10;$i++){
 echo"<option>navi</option>";
}
?></select>

17 August 2019

How TO Scroll Back To Top Button in wordpress?


Scroll Back To Top Button in wordpress


DOWNLOAD JS FILE from https://jquery.com/download/ =       jquery.min.js (jquery-3.4.1.js)

<html>
<head>
<style>




/****************************************
  IMPORTANT
*****************************************/

.scrollTop {
  position: fixed;
  right: 10%;
  bottom: 10px;
  background-color: #BE3F48;
  padding: 20px;
  opacity: 0;
  transition: all 0.4s ease-in-out 0s;
}

.scrollTop a {
  font-size: 18px;
  color: #fff;
}

</style>
<script src="<?php echo plugin_dir_url(__FILE__);?>/js/jquery.min.js"></script>

<script>



// BY KAREN GRIGORYAN

$(document).ready(function() {
  /******************************
      BOTTOM SCROLL TOP BUTTON
   ******************************/

  // declare variable
  var scrollTop = $(".scrollTop");

  $(window).scroll(function() {
    // declare variable
    var topPos = $(this).scrollTop();

    // if user scrolls down - show scroll to top button
    if (topPos > 300) {
      $(scrollTop).css("opacity", "1");

    } else {
      $(scrollTop).css("opacity", "0");
    }

  }); // scroll END

  //Click event to scroll to top
  $(scrollTop).click(function() {
    $('html, body').animate({
      scrollTop: 0
    }, 800);
    return false;

  }); // click() scroll top EMD

  /*************************************
    LEFT MENU SMOOTH SCROLL ANIMATION
   *************************************/
  // declare variable
  var h1 = $("#h1").position();
  var h2 = $("#h2").position();
  var h3 = $("#h3").position();

  $('.link1').click(function() {
    $('html, body').animate({
      scrollTop: h1.top
    }, 500);
    return false;

  }); // left menu link2 click() scroll END

  $('.link2').click(function() {
    $('html, body').animate({
      scrollTop: h2.top
    }, 500);
    return false;

  }); // left menu link2 click() scroll END

  $('.link3').click(function() {
    $('html, body').animate({
      scrollTop: h3.top
    }, 500);
    return false;

  }); // left menu link3 click() scroll END

}); // ready() END





</script>
</head>
<body>


  <div class="right">
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
    <div>sdfdfsdfdfdsfdfsdfdfdfdsfdsf<div>
  </div>

  <div id="stop" class="scrollTop">
    <span><a href="">Top</a></span>
  </div>

<!-- main-->

</body>
</html>


How to get site url path in wordpress?

get site url path in wordpress

<?php echo site_url(); ?>

How to get plugin path in wordpress?

get plugin path in wordpress




<?php echo plugin_dir_url(__FILE__);?>

16 August 2019

How to create logout page with session in wordpress?

Create logout page with session in wordpress

<?php

session_start();

session_destroy();

session_unset();

//echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'";</script>';

if(!isset($_SESSION['ID'])){

 echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'/login-form";</script>';

}

?>

<script>

    location.reload();

</script>

How to create login page with session in wordpress.

create login page with session in wordpres
<?php
session_start();
if (isset($_SESSION['ID']))
{
echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'/login-dashboard";</script>';
}


<?php
if(isset($_POST['submit']))
{

$email=$_POST['email'];
$password=$_POST['password'];
       
        global $wpdb;
        $result = $wpdb->get_results ( "SELECT * FROM `wp_apindt_employee` WHERE email='$email' and password='$password'" );
        foreach ( $result as $print ) 
        {
           $ID=$print->ID ;



    }


           

$count = count($result);
if($count > 0)
{
session_start();
$_SESSION['ID']=$ID;
   echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'/login-dashboard";</script>';
}
else
{
echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'/login-form/";</script>';
}
  }
?>


<html>
<style>


</style>
<body>
<div class="wrap">
<form action="" method="post">
<div><label>Email</label><input type="text" name="email" placeholder="Email"></div>
<div><label>Password</label><input type="text" name="password" placeholder="password"></div>
<div><input type="submit" name="submit" value="submit"></div>

</form>
</div>
</body>
</html>



14 August 2019

How To Create a Scroll To Top Button in php?

 Create a Scroll To Top Button



<html>
<head>



<script>
// When the user scrolls down 20px from the top of the document, show the button
window.onscroll = function() {scrollFunction()};

function scrollFunction() {
  if (document.body.scrollTop >500|| document.documentElement.scrollTop >500) {
    document.getElementById("myBtn").style.display = "block";
  } else {
    document.getElementById("myBtn").style.display = "none";
  }
}

// When the user clicks on the button, scroll to the top of the document
function topFunction() {
  document.body.scrollTop = 0;
  document.documentElement.scrollTop = 0;
}
</script>
<style>

#myBtn {
  display: none;
  position: fixed;
  bottom: 20px;
  right: 30px;
  z-index: 99;
  font-size: 18px;
  border: none;
  outline: none;
  background-color:#EAC159;
  color: white;
  cursor: pointer;
  padding: 15px;
  border-radius:50%;
  opacity: 0.5;
}

#myBtn:hover {
  background-color: #555;
}
.red{
color:red;
}



</style>
<head>
<body>

<button onclick="topFunction()" id="myBtn" title="Go to top">Top</button>



<h1 class="red" >hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>

<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
<h1>hello man how are you</h1>
</body>

</html>

How to redirect in php after resubmittion with button?

redirect in php


<html>
<body>
<a href="<?php echo site_url(); ?>/test/"><button>click me</button></a>

</body>
</html>





or







echo '<script LANGUAGE="JavaScript">window.location.href="'.site_url().'/customer-list";</script>';

How to send id to another page via href link in wordpress?


 Send id to another page via href link in table list






<div class="row">

<a   href="<?php echo site_url(); ?>/pagename/?ID=<?php echo $print->ID ;?>" class="link">

 <div class="col-2"><?php echo $print->person_name ;?></div>

    <div class="col-2"><?php echo $print->phone ;?></div>

    <div class="col-2"><?php echo $print->email ;?></div>

    <div class="col-2 "><?php echo $print->password ;?></div>
 
</a>
</div>



Get id on anther page with below variable






$id=$_REQUEST['ID'];

13 August 2019

How to delete data from database in wordpress?


Delete data from database






<?php


if(isset($_POST["delete"])){
   global $wpdb;
        $result = $wpdb->get_results ( "DELETE FROM `wp_apindt_parameters` WHERE id=4;" );
}

?>

How to update data in database in wordpress?

<?php

if(isset($_POST["submit"])){
extract($_POST);
$parametername = $_POST['parametersname'];


$id = 4;
/***** updating user *****/
$userstable = $wpdb->prefix . "apindt_parameters";

$where = array(
'ID' => $id
);

$wpdb->update( $userstable,
array(
'parameters_name' => $parametersname,
'wet' => $wet,
'dry' => $dry,
'ac' => $ac,
'dc' => $dc,
'bench_sn' => $benchsn,
'bench_mfg' => $benchmfg,
'bench_model' => $benchmodel,
),

$where);



}

?>

12 August 2019

How to create stylish table with CSS :nth-child() Selector with easy-way?


create table with CSS :nth-child() Selector









<html>

<head>

<style>

.container{

 margin:auto;

 width:80%;

}



.main-row{

 width:20%;

 float:left;

 background-color:#0AA52D;

 text-align:center;

 padding:10px 0px;
 color:white;





}

.col-2{

 width:20%;

 float:left;

 text-align:center;

 padding:10px 0px;

 border-bottom:1px solid #f1f1f1;



}



.row{



 width:100%;

 float:left;

  border-bottom:1px solid #f1f1f1;

}



.row:hover{



 width:100%;

 float:left;

 background-color:#f1f1f1;

}




a.link {

    color:black;

}

.row:nth-child(odd) {
  background:#f1f1f1;




</style>

</head>

 <body>

 <div class="container">

 <div class="main">



    <div class="main-row">Name</a></div>



    <div class="main-row">City</div>

   

    <div class="main-row">Class</div>



    <div class="main-row ">Roll no.</div>

   

    <div class="main-row ">Friend</div>

   

 </div>

 

 

  <div class="row">

   <a   href="#" class="link">

 

    <div class="col-2">Jaspreet singh</div>



    <div class="col-2">Sangrur</div>



    <div class="col-2">+2</div>



    <div class="col-2 ">20</div>

   

    <div class="col-2 ">harpreet</div>

   

   

   </a>

  </div>

  <div class="row">

   <a   href="#" class="link">

 

    <div class="col-2">Jaspreet singh</div>



    <div class="col-2">Sangrur</div>



    <div class="col-2">+2</div>



    <div class="col-2 ">20</div>

   

    <div class="col-2 ">harpreet</div>

   

   

   </a>

  </div>

  <div class="row">

   <a   href="#" class="link">

 

    <div class="col-2">Jaspreet singh</div>



    <div class="col-2">Sangrur</div>



    <div class="col-2">+2</div>



    <div class="col-2 ">20</div>

   

    <div class="col-2 ">harpreet</div>

   

   

   </a>

  </div>

  <div class="row">

   <a   href="#" class="link">

 

    <div class="col-2">Jaspreet singh</div>



    <div class="col-2">Sangrur</div>



    <div class="col-2">+2</div>



    <div class="col-2 ">20</div>

   

    <div class="col-2 ">harpreet</div>

   

   

   </a>

  </div>

 

 </div>







</html>

How to create stylist table in html and css?


Popular table design with hover effect


<html>
<head>
<style>
.container{
margin:auto;
width:80%;
}

.main-row{
width:20%;
float:left;
background-color:#f1f1f1;
text-align:center;
padding:10px 0px;;


}
.col-2{
width:20%;
float:left;
text-align:center;
padding:10px 0px;
border-bottom:1px solid #f1f1f1;

}

.row{

 width:100%;
 float:left;
  border-bottom:1px solid #f1f1f1;
}

.row:hover{

 width:100%;
 float:left;
 background-color:#f1f1f1;
}


a.link {
    color:black;
}


</style>
</head>
<body>
<div class="container">
<div class="main">

<div class="main-row">Name</a></div>

<div class="main-row">City</div>

<div class="main-row">Class</div>

<div class="main-row ">Roll no.</div>

<div class="main-row ">Friend</div>

</div>


<div class="row">
<a   href="#" class="link">

<div class="col-2">Jaspreet singh</div>

<div class="col-2">Sangrur</div>

<div class="col-2">+2</div>

<div class="col-2 ">20</div>

<div class="col-2 ">harpreet</div>


</a>
</div>
<div class="row">
<a   href="#" class="link">

<div class="col-2">Jaspreet singh</div>

<div class="col-2">Sangrur</div>

<div class="col-2">+2</div>

<div class="col-2 ">20</div>

<div class="col-2 ">harpreet</div>


</a>
</div>
<div class="row">
<a   href="#" class="link">

<div class="col-2">Jaspreet singh</div>

<div class="col-2">Sangrur</div>

<div class="col-2">+2</div>

<div class="col-2 ">20</div>

<div class="col-2 ">harpreet</div>


</a>
</div>
<div class="row">
<a   href="#" class="link">

<div class="col-2">Jaspreet singh</div>

<div class="col-2">Sangrur</div>

<div class="col-2">+2</div>

<div class="col-2 ">20</div>

<div class="col-2 ">harpreet</div>


</a>
</div>

</div>



</html>

09 August 2019

How to pass variable id through href in php

<table class="table table-hover">
    <thead>
        <tr>
            <th>Subject</th>
            <th>Add Topic</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <?php foreach($subjects as $sub):?>
            <td><?php echo $sub->subject;?></td>
            <td><a href='approve.php?id=".$sub->id."' role="button" class="btn">Add Topic</a></td>
        </tr>
        <?php endforeach;?>
    </tbody>
</table>

08 August 2019

How to create child theme in wordpress?


    create child theme in wordpress


style.css

/*
 Theme Name:   Twenty Fifteen Child
 Theme URI:    http://example.com/twenty-fifteen-child/
 Description:  Twenty Fifteen Child Theme
 Author:       jaspreetdeveloper
 Author URI:   http://jaspreetdeveloper.com
 Template:     twentyfifteen
 Version:      1.0.0
 License:      GNU General Public License v2 or later
 License URI:  http://www.gnu.org/licenses/gpl-2.0.html
 Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
 Text Domain:  twentyfifteenchild
*/




                                                     functions.php






<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {

    $parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.

    wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
    wp_enqueue_style( 'child-style',
        get_stylesheet_directory_uri() . '/style.css',
        array( $parent_style ),
        wp_get_theme()->get('Version')
    );
}


                                                            or


<?php
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() . '/style.css' );

}






Copy screenshot from parent theme to child-theme folder.

How to create youtube videos slider with play and pause option in wordpress?

Create youtube videos slider with play and pause option in wordpress youtube videos slider Use this shortcode:- [punjab_today] function my_...