WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Problem with tag margins (5 posts)

  1. ggg377
    Member
    Posted 1 year ago #

    Hi again!

    I have developed a pretty annoying problem in WordPress. I have set up my posts in a way that categories, tags and the excerpt appear on the same line. Everything would be fine, except the space between the excerpt and the tag is bigger than that between excerpt and category (if a tag is not posted). I would like the space between everything to be 5px. If I lower the tags-links right margin to 1px (like the category one), multiple tags get nudged together. I might be overlooking something simple here, but I don't see a problem to this solution, because if I set the CSS values of tags and categories to match, the outcome for them is different for some reason (category links never get merged like the tag links do).

    CSS of tags, margins and the excerpt: http://pastebin.com/hrdfDr8U
    Full CSS: http://pastebin.com/ArFptSBW
    index.php: http://pastebin.com/tqwyJejx
    an illustration of the problem: http://i.imgur.com/asG9P.png
    tags with identical settings to the category CSS: http://i.imgur.com/3vyKZ.png
    Website: http://goldenred.web44.net

    Thanks for your help :)

  2. linux4me2
    Member
    Posted 1 year ago #

    It looks like you have a bunch of extra whitespace in your code for all those span tags. I would change all those first and re-test.

    On line 41, this:

    <span class="cat-links">
                                    <?php echo $categories_list; ?>
                            </span>

    should be:
    <span class="cat-links"><?php echo $categories_list; ?></span>

    On line 51, this:

    <span class="tags-links">
                                    <?php echo $tags_list; ?>
                            </span>

    should be:
    <span class="tags-links"><?php echo $tags_list; ?></span>

    Then this on line 59 of your code:

    <span class="excerpt-links">
                                    <?php echo $excerptt; ?>
                            </span>

    should be:
    <span class="excerpt-links"><?php echo $excerptt; ?></span>
    without all the extra whitespace.

    Then you can test again and see if there is still an issue.

  3. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

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

    takes three parameters, which by default are '' (empty strings).

    in your code you have only set the first parameter ($before), but not the $separator - therefore there is no space character between each tag;

    in the category list, the first parameter is the $separator http://codex.wordpress.org/Function_Reference/get_the_category_list
    which you have properly set to be a space character.

  4. ggg377
    Member
    Posted 1 year ago #

    Hi again alchymyth!

    I like that you didn't simply throw the code my way. Had to do some thinking, which fortunately worked out in the end :)

    The code I used is: $tags_list = get_the_tag_list( '',' ','' );

    Thanks a lot!

    Linux: I also cleaned up my code. I know, it's as ugly as sin. I'll clear it all up when the project is done, but I'll also attempt to clean up everything I notice in the process.

  5. linux4me2
    Member
    Posted 1 year ago #

    Your code isn't that bad, it's just easy to miss an extra space in a span tag if you have them as you did. It can make you crazy looking for a solution to spacing problems, so I always fix that first.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.