Customize static wordpress pages correctly

I m building a word press site with a unique theme that i created, now i got like 10 classes of different styles for the static pages in my site.

The question is, when i want to display the content of the page, with all the forms images and text, how should i do that? With the text editor where the user usually insert his content for the posts in regular wp website? Or should i insert the content images and forms hard coded in the php custom page template of those static pages?

In the text editor if i insert some html in edit as html it's becoming a mess it doesn't seems right to create sections and div where the user regularly just put his raw content, and anyway adding more content to a static page in the future will require my intervention to wrap it with css sections and div's definitions and classes...

By the other hand to write raw data with images and forms in the php custom page template doesn't seems to me the right choice... Is it normal to do so for static pages?

Thanks everyone!

Upvotes: 3

Views: 212

Answers (2)

Juanjo Salvador
Juanjo Salvador

Reputation: 1093

Wordpress static pages, by default contains text and images that you can put into it using the Wordpress text editor. This content is known as "The Content" in WP context.

If you want to put into your static page some elements that cannot be setted by the text editor (like your own forms, per example) you'll need to create your own page template with hard-coded elements.

Example:

<?php /* Template Name: My custom page template */ ?>

<?php get_header(); ?>

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<div id="article">
<div class="date"></div>
    <!-- Your own custom content here -->

</div>
<div class="clear"> 
    <?php if ( comments_open() ) : ?><div id="comments"><?php comments_template('', true); ?> </div>
</div><?php endif; ?>

<?php endwhile; ?> 

<?php endif; ?>

<?php get_footer(); ?>

Upvotes: 2

Visitors To Leads
Visitors To Leads

Reputation: 1

I normally will put those styles into styles.css of your theme. Even if it's images that will be standard images for the theme or shortcodes available to the user you want it to load from within the styles.css page. You don't want to do anything static like that with WordPress. Updates can mess it up as well as having issues with inline css messing up your SEO for the site.

If the user needs to do something in the editor to have an image show or something like that you can do it as a shortcode. That's normally going to be your best approach. Have you used shortcodes and loaded the images that before?

Upvotes: 0

Related Questions