user7085085
user7085085

Reputation:

Adding content to wordpress page

So, i finally got my css and js scripts to load on WP

Now there is but one thing i need to get done.

i have my own theme, including header.php, footer.php, page.php

header.php and footer.php is working just fine, loading scripts and showing properly, but now i need to add all the other content.

my page.php is currently:

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

<?php get_header(); ?>

<?php the_content(); ?>

<?php get_footer(); ?>

I would need to somehow add html content to pages, i have about 20 ready made .php pages which needs to be transfered to WP.

Soooo how do i go about making new page (pages -> add new) and using page template while getting the html content to show up?

I've tried to just make new page and in text mode add up all the html into page, but it only shows empty page with header and footer, so the problem is most likely the page.php and i have no idea how to get it to work.

Upvotes: 0

Views: 2229

Answers (4)

figuitiko
figuitiko

Reputation: 44

you can make also a custom loop
 <?php
 $arg = array("post_type" => "services",
                "posts_per_page" => 9,
                "order_by" => "date",
                "order" => "ASC",

            );

            $services = new WP_Query($arg);
            if ($services->have_posts()):;

            while ($services->have_posts()):$services->the_post();
                the_content();             
               endwhile;
            endif;
            ?>

Upvotes: 0

Arpan Sagar
Arpan Sagar

Reputation: 164

You can do look like this:

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

<?php get_header(); ?>

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

Upvotes: 2

Jose Gomez
Jose Gomez

Reputation: 628

You are on the good way. While developing a custom theme from scratch is a great challenge it's not too hard.

I could recommend to take it easy and follow this tutorial I found really helpful some time ago, I learned a lot there:

Developing a WordPress Theme from Scratch

You must have the official source documentation always in your mind:

Theme Development

Do some reading and you will see that making themes is really fun and gratifying :)

EDIT: I would recommend picking a good starter theme or framework and work using child themes. You have plenty of them to pick.

Upvotes: 2

Masivuye Cokile
Masivuye Cokile

Reputation: 4772

  1. To get started adding a new page to your WordPress site, find the Pages menu in the WordPress Dashboard Navigation menu. Click Add new.

The WordPress page editor looks nearly identical to the post editor, except for a few different boxes located on the right side of the screen.

  1. Add the title of the page, like About. Note: If you have pretty permalinks set up, the title of your page will also be the URL slug.

  2. Next, add some content.

  3. The Publish section of the page editor is exactly the same as for writing posts. When you’re ready to publish, you can either publish immediately, save this or a draft, or schedule the page to be published later.

  4. The Page Attributes section applies a parent page and template to your new page. For the Parent section, you can arrange your pages into hierarchies. For example, you could create this new page with additional pages under it. There are no limits to how many levels you can nest pages.

  5. Some WordPress themes have custom page templates, so the next Template section allows you to apply a template to your new page.

  6. The Order box allows you to order your page numerically. Pages are usually ordered alphabetically, but you can choose your own order by entering a number in this field.

  7. Preview the page one last time, then click Publish. You’ve added a new page to your WordPress site.

This is how your your index.php should look like :

<?php
 get_header();?>

<div class="YourContainer">

 <div class="Whatever">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  <div class="ContentSectionDiv">

   <?php the_content();?>

  </div>
  <?php endwhile; ?>
  <?php else: ?>
<?php endif; ?>
 </div>
</div>


 <?php get_footer();?>

Upvotes: 1

Related Questions