WordPress.org

Ready to get started?Download WordPress

Forums

How to change the div that make post to another div? (6 posts)

  1. digitalmonkey
    Member
    Posted 5 years ago #

    Hi, I'm not sure how to explain this since I have very basic knowledge of php so please be genital :P

    I've been designing a my wordpress blog with the help of online video tutorials and a CSS that was made for me but me being my I had to try it myself and got myself in abit of a mess.

    here's the problem:

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

    <div id="content">
    <div id="--generate blog name here--" class="blog"> <p class="date"><?php the_time('F')?>
    <span><?php the_time('jS')?></span></p>
    <div class="blog_small">

    For div container "--generate blog name here--" I want to create a php that will automatic gets the id of posts ie: like it does in the standard wordpress theme;

    <div class="post" id="post-<?php the_ID(); ?>">

    I know that the code above/\ creates post but I want my own div container (<div id="--generate blog name here--" class="blog">) to take it's place without changing it's class from blog to post.

    is there a way to do this? Did this even make sense?...
    anywho here's part of my CSS that the blog class

    div#container div#content{
    clear:both;
    padding:15px 15px 0;
    }

    div#container div.page,
    div#container div.blog{
    margin:10px 0 0 0;
    }
    div#container div.blog p.date{
    float:left;
    width:65px;
    height:52px;
    font-size:14px;
    text-align:center;
    padding:10px 0 0 0;
    }
    div#container div.blog p.date span{
    font-size:20px;
    line-height:28px;
    font-weight:bold;
    }
    div#container div.blog div.blog_small,
    div#container div.blog div.blog_large{
    margin:0 0 0 80px;
    }
    div#container div.page div h2,
    div#container div.blog div h2{
    font-size:26px;
    margin:0 0 15px 0;
    font-weight:normal;
    font-family:"Trebuchet MS",sans-serif;

    any help would be much appreciated :)

  2. Pranav Rastogi
    Member
    Posted 5 years ago #

    <div id="<?php the_ID(); ?>" class="blog">

    If I got it right what you were saying, the above code should do it.

    - Pranav

  3. digitalmonkey
    Member
    Posted 5 years ago #

    thanks for the fast reply :) I've tried what you've suggested and it worked partly worked :)

    but now my title for my post <h2> isn't working correctly or think it's generating it without the style sheet settings.

    div#container div.page div h2,
    div#container div.blog div h2{
    font-size:26px;
    margin:0 0 15px 0;
    font-weight:normal;
    font-family:"Trebuchet MS",sans-serif;

    It should make the Title using these settings above but I'm not sure why it isn't. Is because it's not in div container named: iv#container div.page div h2?

  4. alchymyth
    The Sweeper & Moderator
    Posted 5 years ago #

    instead:

    div#container div.page div h2,
    div#container div.blog div h2{

    it should read:

    div#container div.page h2,
    div#container div.blog h2{

    no 'div' between 'page' and 'h2' (and 'blog' resp.)

  5. digitalmonkey
    Member
    Posted 5 years ago #

    hmmm. that way of writing it works fine on the html page. I think it's correct because it's part of the CSS cascade.

    here's the way it's written in my htlm:

    <div id="content">
    <div id="blog-508" class="blog">
    <p class="date">June
    <span>30th</span></p>
    <div class="blog_small">

    <h2>Title</h2>
    <p class="tags">Tags:</p>

    along with the part of the CSS style sheet:

    div#container div#content{
    clear:both;
    padding:15px 15px 0;
    }

    div#container div.page,
    div#container div.blog{
    margin:10px 0 0 0;
    }
    div#container div.blog p.date{
    float:left;
    width:65px;
    height:52px;
    font-size:14px;
    text-align:center;
    padding:10px 0 0 0;
    }
    div#container div.blog p.date span{
    font-size:20px;
    line-height:28px;
    font-weight:bold;
    }
    div#container div.blog div.blog_small,
    div#container div.blog div.blog_large{
    margin:0 0 0 80px;
    }
    div#container div.page div h2,
    div#container div.blog div h2{
    font-size:26px;
    margin:0 0 15px 0;
    font-weight:normal;
    font-family:"Trebuchet MS",sans-serif;

  6. digitalmonkey
    Member
    Posted 5 years ago #

    I think I should set this thread to resolve since my main question was answered. thanks everyone for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic