Home › Forums › General Issues › URL to public profil › Reply To: URL to public profil
Thank you for your help, Following your indication, I did this with chatGPT, Here is my code:
<? php if (is_user_logged_in()) { $user_id = get_current_user_id(); $custom_posts = get_posts(array( 'post_type' => 'profil', 'auteur' => $user_id, 'posts_per_page' => 1, )) ; si (! vide($custom_posts)) { $custom_post_url = get_permalink($custom_posts[0]->ID) ; ? > <a href="<? php echo esc_url($custom_post_url) ; ? >" class="mon-bouton">Voir mon profil</a> <? php } else { echo 'Vous n\'avez pas encore créé de profil.' ; } } else { echo 'Connectez-vous pour voir votre profil.' ; } ? >
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.