badget

Biggest Sale! Special Offer!

Get 50% discount on all of our single themes with this coupon code: #50%SALE

Hurry up! *Limited time offer*

Page templates with the new WordPress

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #116990
    litows4th
    Participant

    By the look of it, the new WordPress engine will not work with the instructions posted here:
    https://www.themehorse.com/theme-instruction/meta-news/#frontpagetemplate

    I understand that the templating code has not been updated to work with WordPress 6+

    I used this snippet to force the template under a page.

    /**
    * Assign Front Page Template to HOME page only
    * Replace HOME_PAGE_ID with your actual HOME page ID
    * Remove this code after running once
    */
    function meta_news_assign_front_page_template() {
    $home_page_id = HOME_PAGE_ID; // Replace with your HOME page ID

    if ( get_post_type( $home_page_id ) === ‘page’ ) {
    update_post_meta( $home_page_id, ‘_wp_page_template’, ‘templates/front-page-template.php’ );
    }
    }
    // Uncomment the line below, replace HOME_PAGE_ID, visit any page, then comment it back
    // add_action(‘init’, ‘meta_news_assign_front_page_template’, 999);

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.