Forums

Categories show full posts (11 posts)

  1. danaldinho
    Member
    Posted 1 year ago #

    Hey,

    Does anyone know how I can make the categories of my blog show the full page when you view it in the archives.

    So when you view an archives date, a tag, or even do a search the results always come back with the blog title, no image, and the first paragraph with this on the end: [...]

    But when you click on a category on my blog, I want it to display the whole post including an image and the full paragraph.

    I've seen this somewhere before but I can't remember, so I'm pretty sure it is possible.

    Any help is appreciated.

    Thanks.

  2. vtxyzzy
    Member
    Posted 1 year ago #

    Depending on your theme, it is probably controlled in the archive.php file. Find the_excerpt() and replace with the_content().

  3. danaldinho
    Member
    Posted 1 year ago #

    I just edited:

    <p><?php if ( is_category($vidcat) ) { the_content(); } else { echo strip_tags(get_the_content(), '<a><strong>'); } ?></p>

    But it didn't work how I wanted it.

    It didn't display the images and add the space between each paragraph.

  4. vtxyzzy
    Member
    Posted 1 year ago #

    Can you post a link to a page that shows the problem? What was the code before you edited it?

    The code you showed will only display the full content for the category specified in $vidcat. If what you want is the full content for all categories, you can change it to this:

    <p><?php the_content(); ?></p>

  5. danaldinho
    Member
    Posted 1 year ago #

    In archive.php, I had this:

    <p><?php if ( is_category($vidcat) ) { the_content(); } else { echo strip_tags(get_the_excerpt(), '<a><strong>'); } ?></p>

    I edited it to be:

    <p><?php if ( is_category($vidcat) ) { the_content(); } else { echo strip_tags(get_the_content(), '<a><strong>'); } ?></p>

    And here is a category page: http://www.lilwaynehq.com/category/audio/

  6. vtxyzzy
    Member
    Posted 1 year ago #

    Looks like you need to try just <p><?php the_content(); ?></p>.

  7. keesiemeijer
    moderator
    Posted 1 year ago #

    echo strip_tags(get_the_content(), '<a><strong>');
    Will strip images from the (full) content.
    Why don't you use:

    <p><?php if (is_category()) { the_content(); } else { echo strip_tags(get_the_content(), '<a><strong>'); } ?></p>

    Now you have full posts with pictures on category pages and on other pages you will have full posts without pictures.

    But from what I can see u make use of the_excerpt(); somewhere because you have those [...] thingies on your category page.

  8. vtxyzzy
    Member
    Posted 1 year ago #

    I think the original code had get_the_excerpt();

    <p><?php if ( is_category($vidcat) ) { the_content(); } else { echo strip_tags(get_the_excerpt(), '<a><strong>'); } ?></p>

  9. keesiemeijer
    moderator
    Posted 1 year ago #

    Yeah but that is changed and the category page still uses the excerpt somewhere because of the "[...]".

    echo strip_tags(get_the_content(), '<a><strong>');
    This will give you a full post without images and no "[...]".

    So I suggest to just use:
    <p><?php the_content(); ?></p>
    And see if anything changes.

    And also check with in_category() in stead of is_category()

  10. danaldinho
    Member
    Posted 1 year ago #

    Thanks both of you, it worked.

    Appreciate it so much!

  11. vtxyzzy
    Member
    Posted 1 year ago #

    Glad you got it working! Now, please use the dropdown at top right to mark this topic 'Resolved'.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.