• clickening

    (@clickening)


    Hi,

    I want to customize the customer-private-files-content.template.php template to display the category description just before the file listing. Which variable should I use to print the category description?

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Thomas

    (@tlartaud)

    Hi,

    Sorry for the delay, we’ve been really busy these days to get our site back, and I forgot to answer your thread.

    First, If you want to display a category description, you might want to create a new specific template:
    Copy customer-private-files-content.template.php to wp-content/customer-area/templates/customer-private-files-content-category_archive.template.php (note that the filename changed). This will create a listing template specific to category archives.

    Then, You’ll basically just need to use the term_description() function to display the description for that page. Nothing related to our plugin there, just using a WP function.

    I hope that helps,
    Best regards.

    Thread Starter clickening

    (@clickening)

    Hi,

    I have copied the file customer-private-files-content.template.php into my theme folder in wp-content/themes/child-theme/customer-area/templates/customer-private-files-content.template.php. It shows me all the changes I have applied to the content structure but where I show the description it doesn’t show anything.

    This is the code I have put in:

    <div class=”cuar-collection-description”>
    <?php echo term_description(); ?>
    </div>

    Do I have to pass the term ID parameter to the term_description function? How do I get the value of the term ID?

    Best regards

    Plugin Author Thomas

    (@tlartaud)

    Hi,

    You don’t need to pass the ID if you are on a taxonomy/tag/category page. Maybe make sure you browse files by category.

    If not enough, you can use get_terms().

    Regards.

    Plugin Author Thomas

    (@tlartaud)

    Also,

    I have copied the file customer-private-files-content.template.php into my theme folder in wp-content/themes/child-theme/customer-area/templates/customer-private-files-content.template.php

    Please note that this is not exactly what I said 😉 The file name should be customer-private-files-content-category_archive.template.php in order to only affect category pages, where the term description is needed.

    Regards.

    Thread Starter clickening

    (@clickening)

    Hi,

    I’ve tried everything you say and I can’t get the description to come up.

    I have copied the php/core-addons/customer-private-files/templates/customer-private-files-content.template.php file into wp-content/customer-area/templates/customer-private-files-content-category_archive.template.php and added the following lines:

    <div class="cuar-collection-description">
        <?php echo term_description(); ?>
    </div>

    I have also tried with get_terms()

    <div class="cuar-collection-description">
        <?php
            $term = get_terms();
            echo $term->description;
        ?>
    </div>

    But neither of the two options prints the category description.

    I hope you can help me to display the category description on the private archive category page.

    Best regards

    • This reply was modified 2 years, 11 months ago by clickening.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Show Category Description in Template Private Files’ is closed to new replies.