• Resolved Will White

    (@willpcg)


    I’m looking for a tutorial, or even just a page that references the tags I need to use in order to dynamically split the category description section into two columns.

    You can see what I’m trying to do here:
    https://pinpointcreative.com/revision/web/

    Right now it just displays the category description twice. I’d like to pump up the font-size and line-height, but it would mean the text would need to overflow into the second column, and I’m not sure how to do it.

    I’ve seen articles about using <!–more–> to break up WP content but I haven’t been able to get it working since its not in an excerpt, post or page.

    Any thoughts?

Viewing 2 replies - 1 through 2 (of 2 total)
  • Add your own comment into the description, it should be hidden from view and give you a place to split the content by…

    For example:
    Category Name: Example
    Category Description: This is a description<!–mydivider–>for the category called example.

    Then if i assume for a moment your category description is stored in $category->description (that’s an example var), i’d do something like..

    $category_parts = explode( '<!--mydivider-->' , $category->description );

    ..to split the description into an array..

    Then print them out by key..

    Example:

    <div class="column1"><?php echo $category_parts[0]; ?></div>
    <div class="column2"><?php echo $category_parts[1]; ?></div>

    .. example output..

    <div class="column1">This is a description</div>
    <div class="column2">for the category called example.</div>

    .. do you follow? ??

    Thread Starter Will White

    (@willpcg)

    Followed perfectly. Thanks for that! I think I was just misunderstanding the explode function.

    I ended up using:

    $category_parts = explode( '<!--split-->' , category_description() );

    And now it pulls straight from the category description set in wp-admin splitting the description in half wherever I put the comment in.

    Thanks for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Splitting Category Descriptions into Two Divs’ is closed to new replies.