Category Description

Forums › Forums › Search & Filter Pro › Category Description

Viewing 8 posts – 11 through 18 (of 18 total)
  • Anonymous
    #122379

    I’m not sure I follow you. I’m only trying to get the category description at the moment, not the tag description. How does that relate to errant 1?

    Trevor
    #122381

    Whoops. Crossed threads. My bad.

    I will speak with the developer. are you able to show me the php around that use of print_r?

    Maybe upload the template to dropbox and send me a link to it?

    Anonymous
    #122385
    This reply has been marked as private.
    Trevor
    #122387

    Thanks. I will speak with the developer and get back to you.

    Trevor
    #122566

    It is my code creating the 1. D’oh

    Replace this:

    echo '<pre>',print_r($sf_current_query),'</pre>';
    

    with this:

    echo '<pre>',print_r($sf_current_query,true),'</pre>';
    

    The reason is that the 1 is confirmation that a result was returned. This is because print_r does this by default if you echo it. Adding the true parameter stops it doing that.

    I am unsure why your original adds the 1 though.

    Anonymous
    #122756

    Yeah that works thanks.

    How do I combine the $sf_current_query,true

    with

    $currentCat = $sf_current_query['_sft_project_category']['active_terms'][0]['id'];
    
    Trevor
    #122824

    After you fetch $currentCat there, can you add this on the next line to see what is actually in it?

    echo '<pre>',print_r($currentCat,true),'</pre>';

    Anonymous
    #123028

    Yeah I just get the ID number printing after setting the filter so in my case 7 or 8.

    I’ve added the ‘true’ in my echo statement now and it’s working as expected with no trimming of the 1 needed.

    echo '<div class="cat-desc">' . category_description( $currentCat,true ) . '</div>';
    

    Thanks for your help.

Viewing 8 posts – 11 through 18 (of 18 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.