P
P
Pshkll2016-03-09 21:59:20
CMS
Pshkll, 2016-03-09 21:59:20

How to add different html markup for different pages using Pods?

With the help of WP, I created Pages for the menu (Home, About the site, Delivery, Contacts), translated these pages (so far there are only the page name and CNC) through Polylang. Each of the pages in the layout has a different visual content (html with text), only the header and footer do not change - of course. I need to leave the text for editing in the admin panel (I don’t know how to add fields or something else ...), but html, logically, should change in php along with variables for text output. I heard this can be done through pods.
How do professionals solve such a problem?
Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Alexander, 2016-03-10
@Pshkll

ACF is what you need.

P
Pavel, 2016-03-09
@Palych_tw

Create, for example, main.php in the theme folder. In it write:

<?php
/*
Template Name: glavnaya
*/
?>
<?php get_header(); ?>

  <?php if (have_posts()) : ?>
            <?php while (have_posts()):the_post(); ?>
/*здесь контент страницы в нужной вам разметке */
                <h1><?php the_title();?></h1>
                <?php the_content();?>
                    <?php endwhile;?>
                    <?php else : ?>
                    <?php endif; ?>

<?php get_footer(); ?>

And such template for each necessary page.
In the admin panel, when editing a page, select the "page template" and select one of the created ones. In the site settings in "general", it seems that it is also worth specifying the "main page" as one of the static ones, if you are making some kind of main page.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question