จะเปลี่ยนลิงค์ URL โลโก้สำหรับธีม WordPress ได้อย่างไร? (รวมถึงธีมปฐมกาล)
เผยแพร่แล้ว: 2020-12-07
ที่ Crunchify เรากำลังเผยแพร่เฉพาะบทช่วยสอนคุณภาพสูงและข้อมูลโค้ดซึ่งใช้งานได้โดยไม่มีการเปลี่ยนแปลงใดๆ
เมื่อเร็วๆ นี้ เรายังได้เปิดตัวบริการระดับพรีเมียม และเริ่มจำหน่ายปลั๊กอินระดับพรีเมียมและบริการสำหรับนักพัฒนาอีกด้วย
เมื่อเร็ว ๆ นี้เราได้เปลี่ยนไซต์พรีเมียมของเรา ( https://pro.crunchify.com
) และจับคู่ธีมให้เข้ากับโฮมไซต์ ( https://crunchify.com
)
ขณะทำเช่นนั้น เราสังเกตเห็นว่าควรให้ URL โลโก้ส่วนหัวของ pro.crunchify.com ชี้ไปที่ crunchify.com
วิธีนี้ใช้ได้ผลหากคุณมีคำถามใด ๆ ด้านล่าง
- จะเปลี่ยน URL ของรูปภาพส่วนหัวได้อย่างไร
- การเปลี่ยนแปลง URL โลโก้สำหรับธีมตัวอย่างปฐมกาล
- จะเปลี่ยน URL ของรูปภาพส่วนหัวหลักได้อย่างไร
- จะเปลี่ยนลิงค์รูปภาพส่วนหัวเป็น URL ใด ๆ ได้อย่างไร
- จะเปลี่ยนลิงค์ Header Image เป็น URL ที่กำหนดเองได้อย่างไร
- จะเปลี่ยน URL ของแบนเนอร์ที่สามารถคลิกได้อย่างไร?
- ใน WordPress จะเชื่อมโยงรูปภาพส่วนหัวกับ URL ที่กำหนดเองได้อย่างไร
ฉันกำลังมองหาวิธีแก้ปัญหามาระยะหนึ่งแล้วและได้ติดต่อทีมสนับสนุน Genesis WP ด้วย แต่ไม่ได้รับความละเอียดยกเว้นพอยน์เตอร์และเคล็ดลับบางอย่าง

อย่างที่คุณเห็น ไม่มีวิธีแก้ปัญหาที่ชัดเจนที่ฉันได้รับจากทีม Genesis support
ส
หลังจากนี้ ฉันยังคงมองหาวิธีแก้ปัญหาในการเปลี่ยน Clickable Header Link ใน WordPress หรือไม่?
ในที่สุดหลังจากการลองผิดลองถูก ฉันสามารถเปลี่ยน URL ของโลโก้ส่วนหัวได้
นี่คือรหัส:
เพียงแค่ใส่ลงในไฟล์ functions.php ของธีมของคุณ คุณก็จะทำได้ดี ในกรณีของฉัน ฉันได้ใส่โค้ดนี้ลงในไฟล์ pro.crunchify.com theme's function.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
function crunchify_custom_logo_url ( $ crunchify_logo_html ) { $ crunchify_custom_logo_id = get_theme_mod ( 'custom_logo' ) ; // Make sure to replace your updated site URL $ crunchify_new_url = 'https://crunchify.com' ; $ crunchify_logo_html = sprintf ( '<a href="%1$s" class="custom-logo-link" rel="home" itemprop="url">%2$s</a>' , esc_url ( $ crunchify_new_url ) , wp_get_attachment_image ( $ crunchify_custom_logo_id , 'full' , false , array ( 'class' = > 'custom-logo' , ) ) ) ; return $ crunchify_logo_html ; } // get_custom_logo: Returns a custom logo, linked to home unless the theme supports removing the link on the home page. add_filter ( 'get_custom_logo' , 'crunchify_custom_logo_url' ) ; |
- โปรดตรวจสอบให้แน่ใจว่าคุณเปลี่ยน
crunchify_new_url
เป็น URL ที่คุณต้องการ
จะตรวจสอบได้อย่างไร?

ลองตรวจสอบว่าโค้ดด้านบนใช้งานได้หรือไม่และไม่ละเมิดข้อกำหนดข้อมูลเมตาของโครงสร้างของ Google หรือไม่
ลองดูและเปรียบเทียบมาร์กอัป HTML สองรายการด้านล่าง
ก่อนเปลี่ยน URL โลโก้ส่วนหัวของ WordPress
1 2 3 4 5 |
< div class = "title-area" > < a href = "https://pro.crunchify.com/" class = "custom-logo-link" rel = "home" > < img width = "946" height = "198" src = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" class = "custom-logo" alt = "crunchify-pro-logo-white" srcset = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png 946w, https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white-768x161.png 768w" sizes = "(max-width: 946px) 100vw, 946px" data - attachment - id = "2386" data - permalink = "https://pro.crunchify.com/crunchify-pro-logo-white/" data - orig - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" data - orig - size = "946,198" data - comments - opened = "1" data - image - meta = "{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data - image - title = "crunchify-pro-logo-white" data - image - description = "" data - medium - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" data - large - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" > < / a > < p class = "site-title" > Crunchify Pro < / p > < p class = "site-description" > Premium Services , Plugins & Digital Downloads < / p > < / div > |
หลังจากเปลี่ยน URL โลโก้ส่วนหัวของ WordPress
1 2 3 4 5 |
< div class = "title-area" > < a href = "https://crunchify.com" class = "custom-logo-link" rel = "home" > < img width = "946" height = "198" src = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" class = "custom-logo" alt = "crunchify-pro-logo-white" loading = "lazy" srcset = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png 946w, https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white-768x161.png 768w" sizes = "(max-width: 946px) 100vw, 946px" data - attachment - id = "2386" data - permalink = "https://pro.crunchify.com/crunchify-pro-logo-white/" data - orig - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" data - orig - size = "946,198" data - comments - opened = "1" data - image - meta = "{"aperture":"0","credit":"","camera":"","caption":"","created_timestamp":"0","copyright":"","focal_length":"0","iso":"0","shutter_speed":"0","title":"","orientation":"0"}" data - image - title = "crunchify-pro-logo-white" data - image - description = "" data - medium - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" data - large - file = "https://pro.crunchify.com/wp-content/uploads/2019/04/crunchify-pro-logo-white.png" > < / a > < p class = "site-title" > Crunchify Pro < / p > < p class = "site-description" > Premium Services , Plugins & Digital Downloads < / p > < / div > |
มาร์กอัปโครงสร้างทั้งสองดูดีและแตกต่างเพียงอย่างเดียวที่ฉันเห็นคือ URL โลโก้ และนั่นแหล่ะ

ฉันหวังว่าสิ่งนี้จะช่วยคุณเปลี่ยน URL โลโก้ส่วนหัวของธีม
โปรดแจ้งให้เราทราบผ่านความคิดเห็นและความคิดเห็นของคุณ