Editing certain parts of page template in User mode

I have a web page I am working on in WP which needs some customization.
Firstly I have created a page template that will be used over and over again, only changing parts of the content. I am wondering about available options for me when enabling this fact, through the Admin panel in the HTML Editor(if possible)…

Hope my question is clear enough for you all.

Read More

Let me add some code to show what I am trying to accomplish.

 <div id="header-style">
 <?php get_header();?>
 </div>

 <div id="content">

<div id="about">
 //This is what i want to be able to edit

 </div>

<div id="features">
//This is what i want to be able to edit

</div>

</div>

Related posts

Leave a Reply

1 comment

  1. Dino:

    There are lots of ways you could do this. The main question I would ask you is, who is going to be adding/editing this content? If you’re going to have a community of people adding content, the input needs to be stripped and sanitized (to avoid injecting tags or other harmful content). If its just going to be you, then here’s the easiest/fastest solution:

    Use custom fields. If you can’t see them in the post/page edit screen, go to the little tab on the top right of the post-edit screen that says Screen Options (or something like that) and click “Custom Fields”.

    Once you can see the Custom Fields edit box, you can add as many fields as you want. These are stored as post meta data. You can use the <?php the_meta(); ?> function in the loop to display all of your custom fields.

    You can access a specific field by using get_post_meta(). You pass in the postID and the key of the meta field:

    <?php echo get_post_meta(get_the_ID(), 'my_key'); ?>

    So, for your example, you would add in the post-edit screen:

    about: Some text to go in the about section.

    features: Some text to go in the features section.

    Then, you would access these on your page like so:

    <div id="header-style">
     <?php get_header();?>
     </div>
    
     <div id="content">
    
    <div id="about">
        <?php echo get_post_meta(get_the_ID(), 'about'); ?>
    </div>
    
    <div id="features">
        <?php echo get_post_meta(get_the_ID(), 'features'); ?>
    </div>
    
    </div>