user3242861
user3242861

Reputation: 1929

Wordpress - How to create a custom new page without new php file

I'm creating a custom wordpress template. Usually i create files with the page name, for example if a have a page about, I create a file page-about.php and works fine. And I add acf fields to pages.

But if i want to create a new page with same structure of about pages without create a new php file? How can i do that?

Thank you.

Upvotes: 0

Views: 501

Answers (1)

cody collicott
cody collicott

Reputation: 261

In your question you stated you usually created your custom pages based on the page title, I would recommend you create a custom page template that can be applied to as many pages as needed. You would need to create a .php file along the lines of custom-layout-about.php and put a php comment at the top to let wordpress know it's available.

<?php /* Template Name: custom page layout -- about */ ?>

Then apply your acf fields to target the page template.

Upvotes: 2

Related Questions