ben_aaron
ben_aaron

Reputation: 1512

Add html to custom page in wordpress

I want to have a simple blank page on my wordpress-created website where I can add my custom html code and some js code. I got so far to make a page template that I can choose and the page is actually blank.

So far so good: now, when I add my html code into it, there is nothing. Also, when I inspect the page, there really is no html code whatsoever on this custom page.

Where is my mistake?

Code for the template:

<?php
/*
Template Name: Raw Page
*/

Upvotes: 0

Views: 1308

Answers (1)

Adrian
Adrian

Reputation: 2012

To add a template

In your theme folder create a template file my-template.php

Include

<?php /* Template Name : My Template */ ?> 

at the top of the page

To then display the content from the Wordpress page, in your template file include the call to display the content...

<?php while (have_posts()) : the_post(); 
    the_content();
endwhile; ?>

Go into wordpress, create a blank page, select the template "My Template" on right hand side and save it.

Upvotes: 1

Related Questions