เป็นไปได้ที่จะแทนที่ผลลัพธ์ของ get_template_part ()?
ฉันกำลังทำงานกับธีมลูกฉันไม่ต้องการแทนที่ไฟล์เทมเพลตหลักเพื่อรักษาความเรียบง่ายของธีมลูกรวมทั้งลดจำนวนรหัสและการบำรุงรักษาเมื่อเวลาผ่านไป ในลูปเท็มเพลต index.php ในธีมพาเรนต์ใช้: get_template_part( 'content' ); ซึ่งจะนำมาในcontent.phpฉันต้องการให้มันมีลักษณะเหมือนget_template_part( 'content', get_post_format() );หรือคล้ายกันมากขึ้นเพื่อที่จะนำเทมเพลตต่างๆเช่นcontent-apart.phpเป็นต้นโดยไม่ต้องสร้างindex.phpในธีมลูกเพื่อเขียนทับ ผู้ปกครองสำหรับการเปลี่ยนแปลงบรรทัดเดียว get_template_part() ประกอบด้วย: function get_template_part( $slug, $name = null ) { do_action( "get_template_part_{$slug}", $slug, $name ); $templates = array(); $name = (string) $name; if ( '' !== $name ) $templates[] = "{$slug}-{$name}.php"; $templates[] = "{$slug}.php"; locate_template($templates, true, false); } …