Skip to main content

Posts

Showing posts from 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"

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">

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();     /

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";

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: 15p

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'];

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); } ?>

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>

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&l

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>

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_enq