If you have a page, and need to run PHP code that isn’t in your standard page template, you can:
- Use a custom page template
- Create a template with
page-pagename.php
- Implement and use a shortcode
All three are valid and suitable methods for doing this, however, do not:
- Try to let users place actual PHP code in the post content ( MASSIVE security risk )
There are some other more esoteric options that would take longer to explain, and don’t involve a post ( of type page ). Those aren’t superior in any way other than that they require a greater knowledge of WordPress for the same result.
Related Posts:
- Getting only direct child pages in WordPress with get_pages
- How to add a .php file to WordPress
- Help with a custom page template – listing contents of childpages?
- Custom Template 404 for specific custom post type
- Page Automatically Generated from Theme?
- How to hide all child pages with post_query?
- Populate editor with some content of a page with a page template
- Inject class in body when particular page template is used
- page-slug.php not working but only for specific slug
- How do I add my PHP app to a WordPress page whilst keeping semantic URLs?
- Create a custom theme-specific page, invisible in the admin-panel?
- Why isn’t my link attribute getting my css?
- WordPress post-template null warnings
- Automatic Shortcode Creation with Custom Fields [closed]
- get_the_title() gets printed out twice
- How do I find PHP file that contains content of my page?
- Does wordpress templates always in files or in database?
- WordPress page content outside WordPress
- Using the_excerpt() on a page
- Use .php file as page instead of wordpress page & template file?
- Use WordPress function in php file
- Adding wrapper elements in the_date() like in the_title()?
- Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
- Show meta box only for default page template
- WordPress template page name displayed on screen
- How to check if the current page is at a specified path in the URL?
- Show About and Contact Us page when they’re clicked in the top menu.
- Display custom field on 404 page outside loop
- Parsing Menu Items and Blog Posts
- How to use theme function in post/page?
- My php code is not being executed
- Display all pages – in order
- trouble with page_id & highlighting current page
- Apply class to every third list item? [duplicate]
- How to include custom code on a page that’s set to act as homepage?
- Editing a PHP file to include a small text piece on every page
- Can a page contain php code?
- What’s the best way to include PHP code in pages?
- Automatically add images to a menu
- Short code template + ajax
- Need php code’s output to display underneath a Divi Module
- Insert page content into another page with a changed variable
- How to echo every parent page title?
- get_page_template_slug returns incorrect path
- How Do I Find & Remove H1 From Site-Title-Wrapper? [closed]
- Dropdown menu for categories
- Retrieve Json data and create multiple pages with it
- How to add page numbering with php?
- Display child page content of a specific parent on home page
- Noindex subscriber author page
- Posts are not looping through correctly
- Removing custom sort order from admin page listing
- PHP Output also in Child theme, but different
- $wpdb->get_results breaking page?
- Unique PHP on each Page
- How to Display a List of Child Pages For a Parent Page in WordPress
- If is page, archive or search output this code
- Make a page (url) not cacheable [closed]
- WordPress Search
- List all anchor links on a page
- Toolbar Hidden in a Virtual Page
- Display additional page templates and a sidebar on plugin activation
- Page load timer?
- Why wp_remote_get() fetches certain web pages while it doesn’t work for my localhost?
- Page not visible in ‘All pages’ after being added through PHP
- Cascading dropdown select search based on Parent Page & Child Page
- Edit and delete permissions pages and posts
- My worpress search page is showing no results
- A function to get the content of a page
- Prevent header and footer from loading on specific pages with template or plugin
- Contain multiple page templates in one PHP custom template file in WordPress?
- How can I check if a post with a particular slug or title exists?
- When I click for the redirect link it is showing the content of index.php instead of single_assignment_page.php
- Category Page Displaying all Pages
- WordPress add custom search
- How can I edit a php custom page template to work in other themes?
- Split post or page content in two or more columns
- Display page content in different sections – based on page break block?
- Page template not working when logged out
- How to Change Site Elements based on referring URL
- How to add a full working piece of website already coded, to a large scale Website design project?
- Child and Parent Pages list of sub pages
- Static Page with php echo [duplicate]
- How to tell if a page has subpages for Custom Post Types
- loading a php file to a specific page id
- Use wordpress for /blog section only and all other pages static, but using same footer.php and header.php
- Getting page / post URL on publish and / or update
- remove_action() not working in page template – Genesis
- Use page-templates without creating theme
- Get current_post in reverse order with pagination
- can’t grab PHP $_POST variable
- Pass form attributes to another php template in wordpress
- How to associate dynamic PHP page for chosen WordPress tag?
- Newbie question. Login/Registration. New PHP page
- Code works on page-example.php by not category-example.php
- Calling PHP function doesn’t work in index.php
- Adding my own custom template page but got white page
- Create page in templates for pages or the pages manager?
- Replace content in WordPress Page after GET from php page
- List of child pages fetch next results at link click