• Resolved serg2016

    (@serg2016)


    Good afternoon
    When creating a new post, we want to automatically include the lazyblock we created. We do it with the following code

    
      function myplugin_register_template() {
        $template = array(
          array('lazyblock/consilia-post-head'),
        );
        $post_type_object = get_post_type_object( 'post' );
        $post_type_object->template = $template;
      }
      add_action( 'init', 'myplugin_register_template',20 );
    

    Everything works great, but we still need to programmatically set the value of the fields in controls. How can we contact them? The following code, alas, does not work.

    function myplugin_register_template() {
        $template = array(
          array('lazyblock/consilia-post-head-test',array('text')),
        );
        $post_type_object = get_post_type_object( 'post' );
        $post_type_object->template = $template;
      }
      add_action( 'init', 'myplugin_register_template',20 );
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[NSFW] Add lazyblock to new posts’ is closed to new replies.