different style for posts and pages in wordpress

Discussion in 'WordPress' started by frustik, Dec 14, 2010.

  1. #1
    hello,
    I need a step by step help to understand how could make a style for posts and another style for pages in wordpress.
    I'm new in WP so please you should be the most explicit.


    thaNk you for your help
     
    frustik, Dec 14, 2010 IP
  2. pmp123

    pmp123 Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #2
    If you go to the theme editor in wordpress backend you will see a list of files on the right side look for single.php this is for displaying your blog posts, you can edit the file code to make any changes here you must have atleast some basic knowledge of php to edit this file. To be safe first save all code on this page as backup and then start making changes.
    To edit the page file look for page.php.
    If you have access to physical files like local wamp or FTP then you can access these files at wordpress directory/wp-content/themes/your theme name/

    If you only want to change styles(css) then you will have to edit the CSS file named as styles.css
     
    pmp123, Dec 14, 2010 IP
  3. Yuuko008

    Yuuko008 Member

    Messages:
    682
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    33
    #3
    Go to your wp-admin>Appearance>editor. Basically you will be editing 2 files.

    1.] single.php (this is for posts)
    2.] page.php (this is for pages)

    Just alter the style on the 2 files to your desired style :)
     
    Yuuko008, Dec 14, 2010 IP
  4. frustik

    frustik Well-Known Member

    Messages:
    941
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    1
    #4
    this is the code i have in page.php:

    <?php get_header(); ?>
    <?php get_sidebar(); ?>

    <!-- start content -->
    <div id="content">

    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="post" id="post-<?php the_ID(); ?>">
    <h1 class="title"><?php the_title(); ?></h1>
    <div class="entry">
    <?php the_content('<p class="serif">Read the rest of this page &raquo;</p>'); ?>

    <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>

    </div>
    </div>
    <?php endwhile; endif; ?>
    <?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
    </div>
    <!-- end content -->

    <?php include (TEMPLATEPATH . '/_sidebar2.php'); ?>

    <?php get_footer(); ?>



    if i have understood I have to change the css file, and i should create other css code exclusively for the pages but what in the above code i have to replace?
     
    frustik, Dec 14, 2010 IP
  5. Yuuko008

    Yuuko008 Member

    Messages:
    682
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    33
    #5
    Well what you need to replace are your div classes and use another variable as your class.
     
    Yuuko008, Dec 14, 2010 IP
  6. pmp123

    pmp123 Member

    Messages:
    219
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    26
    #6
    You need to create a new class and replace it in this php code like
    <h1 class="title"><?php the_title(); ?></h1>
    <div class="entry">

    Class="title" should be replaced with your new class and it becomes
    <h1 class="page_title">
    <div class="entry"> becomes <div class="page_entry">
     
    pmp123, Dec 14, 2010 IP
  7. frustik

    frustik Well-Known Member

    Messages:
    941
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    155
    Digital Goods:
    1
    #7
    Thank you,
    I will try...
     
    frustik, Dec 17, 2010 IP