Roots Discourse

Get blade template file URL in PHP

I am trying to use wp_insert_post to create page.

function create_page($title_of_the_page, $content, $template, $parent_id = null)
{
    $objPage = get_page_by_title($title_of_the_page, 'OBJECT', 'page');

    if (!empty($objPage)) {
        return $objPage->ID;
    }

    $page_id = wp_insert_post(
        array(
            'comment_status' => 'close',
            'ping_status'    => 'close',
            'post_author'    => 1,
            'post_title'     => ucwords($title_of_the_page),
            'post_name'      => strtolower(str_replace(' ', '-', trim($title_of_the_page))),
            'post_status'    => 'publish',
            'post_content'   => $content,
            'post_type'      => 'page',
            'post_parent'    =>  $parent_id,
            'page_template'  =>  $template
        )
    );
    return $page_id;
}

I wish to add template. How do I add the path for a template-something.blade.php. How can I get that ?

This topic was automatically closed after 42 days. New replies are no longer allowed.