Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1034841
    lexidev
    Participant

    I have the code which seems to work and have placed it in various different child theme files within the Renew view. Found an old post that adds the description below the category archive title, but that pushes the page down and allows only for a few words. The code I have is:

    <p class="cat-desc"><?php echo category_description(); ?></p>

    It works, but I need to know how to place it so that it is displayed above the tiled posts, within the content wrapper in that category archive. Please see the screen print.

    Please advise.

    #1035349
    Lely
    Moderator

    Hi There,

    Thank you for the screenshot. We can add it on content.php file. Copy content.php from wp-content/themes/x/framework/views/renew to this folder wp-content/themes/x-child/framework/views/renew. Open the copied file and replace the code with the following:

    
    <?php
    
    // =============================================================================
    // VIEWS/RENEW/CONTENT.PHP
    // -----------------------------------------------------------------------------
    // Standard post output for Renew.
    // =============================================================================
    
    ?>
    
    <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
      <div class="entry-wrap">
        <?php if(is_category()): ?>
        <p class="cat-desc"><?php echo category_description(); ?></p>
        <?php endif; ?>
        <?php x_get_view( 'renew', '_content', 'post-header' ); ?>
        <?php if ( has_post_thumbnail() ) : ?>
          <div class="entry-featured">
            <?php x_featured_image(); ?>
          </div>
        <?php endif; ?>
        <?php x_get_view( 'global', '_content' ); ?>
      </div>
    </article>

    You can see that we have added the following code after entry-wrap:

        <?php if(is_category()): ?>
        <p class="cat-desc"><?php echo category_description(); ?></p>
        <?php endif; ?>
    

    Hope this helps.

    #1036530
    lexidev
    Participant

    Thanks for the code, but it doesn’t help. It puts the category description above every post title in the category archive, see attached. I tried tacking it on to the _landmark_header.php and various other places, but the category description repeats every time as many times as there are posts on the archive page, even if I place a div after the posts and outside the ‘article id=”post-…’ element.

    Any other ideas?

    #1036916
    Darshana
    Moderator

    Hi there,

    Please provide us with the URL to your sample category description page, so that we can assist you with a possible workaround in your situation.

    Thanks!

    #1037540
    lexidev
    Participant

    Here is the page. But the solution should work for all categories. Actually having category descriptions available would work for many of my sites, and for this particular site especially. http://www.goodmaninstitute.org/topics/health-reform-bill/

    The category archive .x-iso-container is governed by a script and overlays .x-main .left. So all text I put into the latter is covered by the post excerpts. What I would like to see is the description pushing down only the masonary posts and not also the sidebar.

    I would imagine that you can test your code suggestions in any renew stack setup with masonery archive display. Any help with this is welcome, thanks.

    #1037877
    Rad
    Moderator

    Hi there,

    Instead of editing the content.php, you should edit _index.php from \wp-content\themes\x\framework\views\global\

    Then add this code

        <?php if(is_category()): ?>
        <p class="cat-desc"><?php echo category_description(); ?></p>
        <?php endif; ?>

    before this line of code,

    <?php x_get_view( 'global', '_script', 'isotope-index' ); ?>

    Hope that helps.

    #1043691
    lexidev
    Participant

    Thank you Rad. This worked. I’ve added the plugin “HTML in Category Descriptions” and if you wrap your text carefully into a div that you style yourself you can format the text nicely. Need to know css and html code. Very, very nice addition to the Theme this bit of code. My client and I am thrilled!

    #1043724
    Rahul
    Moderator

    You are most welcome! Let us know if you need any further help and we’ll be happy to assist.

    Thanks

  • <script> jQuery(function($){ $("#no-reply-1034841 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>