December 16, 2016

Wordpress temporary session to save any message?



If you need to save any error OR success message on wordpress function.php file OR any other file then please follow below steps:

Here I explain with one success message save on function file and display on home page:

function.php

<?php
function myTempFun() {
   if(!session_id()) {
       session_start();
   }
   $_SESSION['my_session_name'] = 'Write here any message';
}
?>

home page template.php

if ( array_key_exists( 'my_session_name', $_SESSION ) ) {?>
    <p><?php echo $_SESSION['my_session_name']; ?></p>
<?php
    unset( $_SESSION['my_session_name'] );
}

After session display also unset that , So when you refresh page then second time that session not displaying.

Enjoy!

December 15, 2016

Freelancer Web Developer From India, Gujarat


All type of  PHP, CMS and Framework development with high coding standard.

Freelancer Web Developer From India, Gujarat.

Hire PHP Developer provides ideal solutions for your requirements.

Contact Me:

https://wiseintro.co/montukhant

http://khantmontu.blogspot.in/p/contact-us.html

Mobile No: 9033665158

Email: montukhant@gmail.com

Skype: montukhant

Integrating Google reCAPTCHA v3 in HTML Form with PHP

  What is Google reCAPTCHA v3? Google reCAPTCHA is a free service that helps protect websites from spam and abuse. reCAPTCHA v3 is the lates...