WordPress.org

Ready to get started?Download WordPress

Forums

Hueman
[resolved] How to show "No posts" message in category page (6 posts)

  1. presswolfe
    Member
    Posted 6 months ago #

    Hi,

    In the Hueman Theme, I want to add a message such as "There are no posts" on a category page if the category currently doesn't have any posts in it. Also I would like to include some text below the message that will point the user to another URL.

    Is there a simple way to code this? Which file should I edit in order to do this?

  2. presswolfe
    Member
    Posted 6 months ago #

    @Alexander Agnarson

    Hi Alex, no replies from anyone else on this yet. Is there a way that I can show the message "no posts" in a category that hasn't any posts in it?

  3. Alexander Agnarson
    Member
    Theme Author

    Posted 6 months ago #

    Hi,

    In archive.php, on line 25, locate:

    <?php endif; ?>

    Replace with:

    <?php else: ?>
    <p>Nothing here</p>
    <?php endif; ?>
  4. presswolfe
    Member
    Posted 6 months ago #

    Awesome. It worked. Thank you!

  5. presswolfe
    Member
    Posted 6 months ago #

    How can I apply a CSS style to the text?

    I'm having trouble with the code applying the CSS within the PHP file.

  6. presswolfe
    Member
    Posted 6 months ago #

    Ahhh nevermind. Figured it out. Just had to put the defined CSS styles at the top of the "archive.php" and applied the class names to the tags.

    Thanks

Reply

You must log in to post.

About this Theme

About this Topic