• Resolved shadeypwns

    (@shadeypwns)


    I’m currently attempting to build my own theme from the ground up while learning php at the same time, how fun. My question is about the Latest News section on my site here – https://107.9.172.144/

    Underneath the posts title is the authors name and what category the post was placed in, which is called up by the following code:
    By <?php the_author_posts_link() ?> in <?php the_category() ?>

    Simple right? I have no idea why the first part (By “authors name”) and the second part (in “category”) are split and aligned completely apart and on seperate lines.

    When PHP outputs to text does it do some sort of autoformatting? How can I change this? I should also mention that this code is being formatted by a css div with the following code:

    .postdata {
        margin: auto;
        text-align: left;
        font-family: verdana;
        font-size: 12;  
    
    }

    Thank you to anyone who can explain this to me!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Your postdata style is being overridden by the more specific ul style on line 15 of style.css

    Use Firebug or Chrome’s inspector help you debug CSS problems.

    Thread Starter shadeypwns

    (@shadeypwns)

    Thank you very much! I’m still not sure I understand why it thinks that the text is an unordered list though..

    Thread Starter shadeypwns

    (@shadeypwns)

    Nevermind! Obviously calling the the_categories displays the output as a list by default.. I’m sure there’s a way to change this and I’ll look it up now. Thank you again!’

    Edit: For future googlers, the following code adds a seperator between categories, and removes the hardcoded “unordered list” formatting:

    <?php the_category(', ') ?>

    This creates a comma between categories.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Formatting Text Output From PHP’ is closed to new replies.