How to create a function in a custom page and use it in single.php
?
I have the custom page mypage.php
<?php
/* Template Name: Form */
...
$myname = add_post_meta( $date, 'My Name', $name, true );
function name(){
if ($myname != ''){
echo ="Hello World! ";
}
}
get_header(); ?>
...
?>
Single page
<? php name(); ?>