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!
I am so grateful to find your particular post. I have bookmarked this website and I will keep visiting you for further such interesting posts.
ReplyDeleteWeb Company in India Company | Web development Company Bangalore
Web Development Company in Bangalore | Responsive Web development
I have read your blog its very attractive and impressive. I like it your blog.
ReplyDeletePHP 7 Training in chennai | PHP 7 Training Course
PHP 7 Training in chennai | Online PHP 7 Course
read this blog this is helpful for you to https://www.weblinkindia.net/blog/wordpress-website-complexity-impacts-seo
ReplyDelete