0

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
*/
0

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

8 Comments

That's what I've done, but if I want to add html to this blank page, there is nothing on it when I choose my new template.
Sure, sorry. See above.
just to be clear, where exactly are you posting the html code? on the template file or on the wordpress page?
because if its on the wordpress page, you must call the function to show that content in the template file
Oh that's probably it. I write it on the wordpress site. How could I 'connect' the html code on the wordpress page to the template? That would be awesome!
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.