K
K
KVS172013-11-20 08:15:58
css
KVS17, 2013-11-20 08:15:58

How to change the appearance of just one page in wordpress?

The whole question is in the title. The task is this - on one page to put the title a little closer to the header than on other pages.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
S
Sergey Larionov, 2013-11-20
@KVS17

If the theme is done properly, the body tag contains a class that identifies the page, for example

<body class="page page-id-989 page-template-default">
To solve the task, it is enough to add something like this to the CSS of the theme:
body.page-id-989 .класс-заголовка {
 /* тут нужные изменения */
}
here 989 is nothing but the id of the post.

R
Roman, 2013-11-20
@SRoman

You can implement a page template and select it when editing the page.
Here is an example of a template placed in the theme folder:

<?php
/*
Template Name: Свой шаблон страницы
*/
get_header();

get_sidebar();
get_footer();?>

X
xaja, 2013-11-20
@xaja

Is the header a head or just a general designation for a header?
Do you need to raise it visually or in code?
How much higher?
if visually, then for each page wordpress generates its own class in the body. Further, I think it's clear.
if in the code, and, for example, the title needs to be moved to header.php, then you can do this

$page = ''; // id, название или slug страницы
if (is_page($page)) {
echo '<h1>'.get_the_title($ID);.'</h1>';
}

K
KVS17, 2013-11-20
@KVS17

and will it be so good?

$page = ''; // id, название или slug страницы
if (is_page($page)) {
echo <bz1>.get_the_title($ID);.</bz1>;
}

CSS: body.page-id-X bz1 {margin-top:-10px;}

K
KVS17, 2013-11-20
@KVS17

What is not like ((

$post->ID = '2'; // id, название или slug страницы
if (is_page($post)) { echo 'zdfgxdfgb';
          <?php if(get_post_meta($post->ID, 'url', true)) { ?>
          <bz><a href="<?php echo get_post_meta($post->ID, 'url', true); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></bz>
          <?php } else { ?>
          <bz><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></bz>
          <?php } ?>

}

A
AshGrey, 2013-11-24
@AshGrey

Maybe a sparrow cannon... But wouldn't it be easier (for this one page) to create a child theme with this little change? Above, SRoman already offered this option by the way.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question