WordPress.org

Ready to get started?Download WordPress

Forums

Create custom page that client can edit? (13 posts)

  1. Buffmin2
    Member
    Posted 2 years ago #

    Please tell me if I am way off-base.

    First of all, I am trying to learn to create my static websites using WP, so my clients are able to edit the content.

    1) I created a template page and named it "my_template.php"
    2) I then created a page in WP and selected this as my template.

    Now, in my_template.php, I created a div with some text in it.

    The problem is that when I view the page in the dashboard, I cannot see the text (to edit).

    I think my way of thinking is way off!

    I'd appreciate some direction. Thanks, Buffmin.

    My example...... http://doubledoubleny.com/test1/

  2. Harrison O.
    Member
    Posted 2 years ago #

    It works the other way around. The text should be entered in the WP write panel and not directly into the template.
    Create a template from the page.php so this way you'll have the loop in place. After that, the content you enter inside the write panel should be displayed on your page.

  3. WPyogi
    Volunteer Moderator
    Posted 2 years ago #

  4. Buffmin2
    Member
    Posted 2 years ago #

    Ah, cool! I will try that. I knew I had something backwards.
    I appreciate the help.

    If I want the content to be, say.... in a blue div with a border, would I code that div in html tab of the "write panel"?

    Thanks again.

  5. Harrison O.
    Member
    Posted 2 years ago #

    The div should be styled on the style.css file or you can style it inline:

    <div style="border: 2 solid #069;> loop here </div>
  6. Buffmin2
    Member
    Posted 2 years ago #

    Yeah, maybe got the errors, because I didn't make my template from the page.php file, or because did a quick hacking job, I am not sure, because I believe I closed my divs (my_template.php code is below).

    Good advice about the styling in the style.css, but would I still assign the div in the "WP write panel"(html tab)?

    Wow, thanks all for the quick responses.

    <?php
    
    /**
     * Template Name: My Template
     */
    
    get_header(); ?>
     <div id="container" >
    	<div id="content" role="main">
    
                <div id="div1">Content for page called "Test"</div>
    
    	</div><!-- #content -->
     </div><!-- #container -->
  7. raskull
    Member
    Posted 2 years ago #

    <div id="div1">[put page.php code (the_content part) here]</div>

  8. Harrison O.
    Member
    Posted 2 years ago #

    Since this template is specific for one page only, you can assign the div into the template. Leave the write panel only for text, otherwise your client may delete the div and mess up the page.

  9. Buffmin2
    Member
    Posted 2 years ago #

    Do you mean put just this part?..... <?php the_content(); ?>

  10. Harrison O.
    Member
    Posted 2 years ago #

    BTW, since you are learning how to create static websites with WP, you may consider learning how to use a plugin like http://wordpress.org/extend/plugins/advanced-custom-fields/ which will allow you having more write panels per page. That is, if your page has more than one block of text, you can create one write panel for each block instead of using only one as it is now.

  11. Harrison O.
    Member
    Posted 2 years ago #

    yes, you can wrap the div there. <div id="div1"><?php the_content(); ?></div>

  12. raskull
    Member
    Posted 2 years ago #

    Do you mean put just this part?..... <?php the_content(); ?>

    yup, just do it. you could also just unselect your template in favor of the default template (page.php) and it will kick in.

  13. Buffmin2
    Member
    Posted 2 years ago #

    Ah, sweet! I didn't know that there was a plugin for that, but I hoped there was some way to do it.

    Thank you all for your direction. I was heading no where fast!
    I was getting discouraged. Excited now!

Topic Closed

This topic has been closed to new replies.

About this Topic