• Resolved scudelari

    (@scudelari)


    Hello,
    I’m quite sure that this is possible, but when I tried to check for the correct data I was simply unable to find it.
    The problem I’m facing is the following.

    I’m building a pretty customized theme for a site and I must, at the same page, separate the posts by it’s sub-categories.
    They are all at the same main category but the sub-categories ate different.

    So, it has to be something like this:
    Category 3 (main)
    Subcat1:
    – Posts that belongs to Subcat1
    Subcat2:
    – Posts that belongs to Subcat2
    Subcat3:
    – Posts that belongs to Subcat3

    The problem is that the user must be able to change/delete/insert subcategories. So this must be make dynamically.

    The idea I’ve had is to get all these datas with The WordPress Loop, store them in php arrays, do what I must and print the correctly. No big deal.

    The problem lies with the post content. I must get the content and store them in a PHP array. If I use the $post[‘post_content’], I get the ENTIRE post content, when I want to get the content as it would be given by the the_content function. Which means that I want the post content until the “more” separaor.

    Thanks for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Hmm. While I debate whether you need to store the data, that’s neither here nor there. You are doing it so I’ll tell you how to filter it.

    Normally, doing get_the_whatever() instead of the_whatever() will work, but for the_content() that’s not exactly the case. All the filtering is done on the_content() and not get_the_content().

    So, apply the_content filtering yourself. Just do this:
    $filtered_content = apply_filters('the_content', get_the_content());

    And there you go. The get_the_content() function does the more stuff, but it doesn’t do all the texturizing and HTMLifying that the_content filter does.

    Thread Starter scudelari

    (@scudelari)

    Hello,
    Thanks for your help. As a matter of fact, it worked as I wanted just by using the get_the_content, passing as parameter the same I passed to the the_content.
    I didn’t know this function existed. It’s not written in this page.

    But I thank you a lot for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems to get post content to be used in theme PHP’ is closed to new replies.