หน้าแรก › ฟอรั่ม › ถามปัญหาการทำเว็บด้วยเวิร์ดเพรส › สอบถามเรื่องการใช้ [shortcode] / ตัวแปร bbpress url ร่วมกับ SiteOrigin Buntion
ติดป้ายกำกับ: bbpress, การใช้งาน sidebar login
- This topic has 5 ข้อความตอบกลับ, 4 เสียง, and was last updated 5 years, 7 months มาแล้ว by
Ampol Phimphila.
-
ผู้เขียนข้อความ
-
-
1 ต.ค. 2016 เวลา 19:57 น. #22314
Ampol Phimphila
Participantมีวิธีไหนบ้างครับที่จะ [shortcode] / ตัวแปร bbpress url ร่วมกับ SiteOrigin Buntion
เบื้องต้นที่ลองทำดูหรือใช้งานไม่ได้ SiteOrigin สร้าง http:// ขึ้นมาให้เอง
-
2 ต.ค. 2016 เวลา 14:16 น. #22363
AP
Participantเสนอแนะแบบเบื้องต้นก่อนนะค่ะ
http://%bbpress_profile_url% น่าจะใช้ร่วมกับปลั๊กอินตัวนี้ค่ะ sidebar login
ตัวอย่างการนำไปใช้งานลองทำดูตามนี้คะ
ข้อมูลภาพจากพี่เม่นนะค่ะ
-
3 ต.ค. 2016 เวลา 12:45 น. #22428
Ampol Phimphila
Participantพอดีอยากได้หน้าข้อมูลสมาชิก ของ bbpress ครับ คือทำ link ตรงจาก header menu เข้าที่หน้าข้อมูลสมาชิกของ bbpress เลยครับ
ไม่ได้สร้างหน้าสำหรับสมาชิกแบบของ seedthemes
-
4 ต.ค. 2016 เวลา 00:23 น. #22470
LUC|AN
Participant“`php
/**
* Add bbp user profile link in WP nav menu
* Filter wp_nav_menu() to add profile link
*/
function prefix_bbp_profile_link_nav_menu($menu) {if ( !is_user_logged_in() )
return $menu;
else
$current_user = wp_get_current_user();
$user = $current_user->ID;
$bbp_profile_url = bbp_get_user_profile_url( $user);
$bbp_profile_menu_link = ‘‘;
$menu = $menu . $bbp_profile_menu_link;return $menu;
}
add_filter( ‘wp_nav_menu_items’, ‘prefix_bbp_profile_link_nav_menu’ );
“`ลองเพิ่มโค้ดด้านบนลงในไพล์ Theme Functions (functions.php) ดูนะครับ
ถ้ายังไม่ตรงตามความต้องการ ขอรายละเอียดเพิ่มเติมด้วยครับCr. https://bbpress.org/forums/topic/is-there-any-way-to-get-forum-root-slug-field-value/
-
15 ต.ค. 2016 เวลา 12:09 น. #23908
Ampol Phimphila
Participantขอบคุณมากครับ
อันนี้ผมลองปรับโค้ดดู เพื่อให้ เมนูแสดง Link Login และแสดงเมื่อ Link Profileว เมื่อ login สำเสร็จ
และปรับเพิ่ม class ให้เข้ากับ seedthemes ที่ใช้งานอยู่
“`php
/**
* Add bbp user profile link in WP nav menu
* Filter wp_nav_menu() to add profile link
*/function prefix_bbp_profile_link_nav_menu($menu) {
if (!is_user_logged_in() ){
$bbp_profile_menu_link = ‘
<li class=”menu-item menu-item-type-custom menu-item-object-custom”><a href=”/login” rel=”nofollow”>’ . __(‘Login’, ‘text-domain’ ) .’ </a>’;
$menu = $menu . $bbp_profile_menu_link;
return $menu;}else{
$current_user = wp_get_current_user();
$user = $current_user->ID;
$bbp_profile_url = bbp_get_user_profile_url( $user);
$bbp_profile_menu_link = ‘
<li class=”menu-item menu-item-type-custom menu-item-object-custom”>’ . <a href=” ‘. esc_url( $bbp_profile_url ) .’ ” rel=”nofollow”> ‘. __(‘Profile’, ‘text-domain’ ) . ‘</a>’;
$menu = $menu . $bbp_profile_menu_link;
return $menu;
}
}
add_filter( ‘wp_nav_menu_items’, ‘prefix_bbp_profile_link_nav_menu’ );“`
-
-
ผู้เขียนข้อความ
- คุณต้องเข้าสู่ระบบเพื่อตอบกลับกระทู้นี้