templates – Display a page without redirection

In a plugin, I want to display a specific page without redirecting (and therefore without changing the URL).

// A. This only displays the content and not the header, footer or title.
$ post = get_page_by_path (& # 39; / some-page / & # 39;);
$ content = apply_filters (& # 39; the_content & # 39 ;, $ post-> post_content);
echo $ content;

// B. This only displays the page template, but does not include the content.
$ template = get_template_part (& # 39; page);
echo $ template;

// C. A combination of both does not include the sidebar or the title of the page.
$ template = get_template_part (& # 39; header & # 39 ;, custom-404-page & # 39;);
echo $ template;
$ post = get_page_by_path (& # 39; / custom-page / & # 39;);
$ content = apply_filters (& # 39; the_content & # 39 ;, $ post-> post_content);
echo $ content;
$ template = get_template_part ('footer', & # 39; custom-404-page & # 39;);
echo $ template;

… I've also tried:

// RE.
global $ post;
$ post = get_page_by_path (& # 40; / custom-404-page / & # 39;)
setup_postdata ($ post);
$ template = get_template_part (& # 39; page);
echo $ template;

but the content of the page still does not appear in the base page template.

Thank you