Create a user page from parent page template

Question

I’m trying to create a user profile page from a parent page profilo.php. I want that when the url is mydomain.com/profilo/username, it shows the user page with the page “profilo” as template. I don’t know why but sometimes it works and sometimes it shows the 404. I think that I have to create some functions in functions.php. If it can be useful, there’s my profilo.php code

<?php

$utente = get_utente();
$idutente = username_exists( $utente );


if($utente == '') {
  echo "<h1>il tuo profilo</h1>";
}
else {
  if($idutente == '') {
    echo "<h1>questo profilo non esiste</h1>";
  }
  else {
    echo "<h1>il profilo di " . $utente . "</h1>";
    echo "<h1>id utente " . $idutente . "</h1>";?>
    <p><?php the_field('categoria', 'user_'.$idutente); ?></p><?php
  }


}


?>


0
Pasquale 4 months 0 Answers 12 views 0

Leave an answer