admin管理员组文章数量:1022552
I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the REST API response (custom post type). I have tried this:
<?php function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) ) {
return 0;
}
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );
<?php
if ($user-> ID == 5){
get_post(13);
}
else ( get_post(3));
?>
My idea is if it's user 5, show the page, if not show another page...
I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the REST API response (custom post type). I have tried this:
<?php function get_current_user_id() {
if ( ! function_exists( 'wp_get_current_user' ) ) {
return 0;
}
$user = wp_get_current_user();
return ( isset( $user->ID ) ? (int) $user->ID : 0 );
<?php
if ($user-> ID == 5){
get_post(13);
}
else ( get_post(3));
?>
My idea is if it's user 5, show the page, if not show another page...
本文标签: customizationneed help with a userspecific custom page template
版权声明:本文标题:customization - need help with a user-specific custom page template 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745503610a2153505.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论