• anotherwordpressnewbie

    (@anotherwordpressnewbie)


    Hi guys,

    As the name suggests, I’m a WordPress newbie. So please, bear with me. I was trying to add category page descriptions in the Twenty Seventeen Theme and tweaked the archive.php file according to some video tutorials out there.

    The descriptions do appear on the category page. BUT they’re placed above the header image instead of underneath it. Has anyone experienced the same problem? How do I go about fixing this?

    Thanks very much!

    NOTE: I mistakenly posted the same question on the Alpha/Beta section of the forum. My apologies!

Viewing 5 replies - 1 through 5 (of 5 total)
  • please post your code.

    Thread Starter anotherwordpressnewbie

    (@anotherwordpressnewbie)

    @alchymyth

    Thanks for the reply! Here are some codes I’ve tried, and all of the instructions said I can paste ’em anywhere on the archives.php of the theme:

    Code 1
    <?php
    /* If the category description isn’t blank…show it! */
    if ( category_description() != “”) { ?>
    <div class=”categoryDescription”><?php echo category_description(); ?></div>
    <?php } ?>

    Code 2
    <?php echo category_description( $category_id ); ?>

    Code 3
    <?php
    the_archive_description( ‘<div class=”taxonomy-description”>’, ‘</div>’ );
    ?>

    I always get the same result: the description appears but above the header.

    Looking forward to your reply, Michael.

    and all of the instructions said I can paste ’em anywhere on the archives.php of the theme

    generally, this is right, however, where you paste the code determines where the category description gets shown – therefore, you need to find a location in the code which reflects the location in your site where you want to see the category description.

    Thread Starter anotherwordpressnewbie

    (@anotherwordpressnewbie)

    I see. I’m totally new to codes…have used WordPress before but never touched the code. Where in the archives.php should I paste it, Michael?

    to show the category description, for example, below the category title, add the code into archive.php (in your child theme) for example after this section:

    <?php
    				the_archive_title( '<h1 class="page-title">', '</h1>' );
    				the_archive_description( '<div class="taxonomy-description">', '</div>' );
    			?>
Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Add Category Page Descriptions’ is closed to new replies.