WordPress.org

Ready to get started?Download WordPress

Forums

I change post on index, single also changes (6 posts)

  1. markomarkogame
    Member
    Posted 1 year ago #

    So whenever I edit css for Main.php also single.php changes.

    This is used for post and single both:
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

    Also about page changes

  2. alchymyth
    Forum Moderator
    Posted 1 year ago #

    try and use more selective styles;
    does your theme use body_class()?

    please post more details about what you have tried so far, and post a link to your site to get more suggestions.

  3. markomarkogame
    Member
    Posted 1 year ago #

    I managed to get a post style/look/div tags for each of files like this:

    for single.php
    <div class="postsingle" id="post-<?php the_ID(); ?>">

    for page.php
    <div class="postpage" id="post-<?php the_ID(); ?>">

    and index.php
    <div <?php post_class() ?> id="post-<?php the_ID(); ?>">

    So I'm asking you is this alright ? What is it normally used for a website to have different styling on page.php,single.php and index.php

    [ please allow quite a bit more time to get a reply - 'bumps' will get deleted]

  4. alchymyth
    Forum Moderator
    Posted 1 year ago #

    What is it normally used for a website to have different styling on page.php,single.php and index.php

    many themes would use the body_class() function to add (web)page specific css classes to the body tag; and use them for targeted styling of static pages, single posts, or index and archive pages.

    http://codex.wordpress.org/Function_Reference/body_class

  5. markomarkogame
    Member
    Posted 1 year ago #

    Yes i did that, in that kind of way.

    But when i target

    .post which is from:( <div <?php post_class() ?> id="post-<?php the_ID(); ?>">)
    everything i do to that tag ends up on the Single.php who also used the same code for post. So then i do that with body class thing
    .single .post
    and then i HAVE to remove for example background image i added to .post. Is there anyway i don't have to go through this ?

  6. markomarkogame
    Member
    Posted 1 year ago #

    Anyone that has any idea
    what to do to avoid this ?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.