WordPress.org

Forums

wp_list_categories() question (3 posts)

  1. fire-enigmax
    Member
    Posted 5 years ago #

    When I call the above function wp_list_categories (with parameters associated) the results are output to the screen. Is there any way that this can be placed into a variable or even to a text file. There is a reason for needing this but it would be complicated to detail!

    I have tried many methods but every time the results get placed onto the screen, I need this to go into a variable or text file and not the screen.

  2. whooami
    Member
    Posted 5 years ago #

    youre going to need to explain yourself a lot better if you want any help.

  3. fire-enigmax
    Member
    Posted 5 years ago #

    hi,

    basically I have call the wp_list_categories() function on all pages within wordpress which I then style to make a navigation bar, this all works fine within wp. However I have a secondary section to my site which i want to also use the same navigation bar.

    I have tried using the include wp-blog-header function however this results in a conflict of classes on certain pages.

    A work-around that I can think of is to call the wp_list_categories() function from within the wp section of the site, but instead of putting it to the screen I could place it in a variable which can then be output to a text file.

    Then from within the offending/problem section pages I can then just include the text file and this will display the nav bar without problems/conflicts.

    I have tested by copying the listing html output from the wp pages and manually placing it in a text file and pulling this file in again to the other sections. This works fine..

    So all I need to know is how to get the category listing to automatically write the results of the function to the text file.

    Manually doing this is not possible all the time as if the user changes the name of categories in one section I need to have these updatable in the text file automatically.

    Any help would be great, hopefully this has explained my problem better?

Topic Closed

This topic has been closed to new replies.

About this Topic