Support » Themes and Templates » creating html fragments, not full pages with wordpress for consumation by extern

  • I need an external app to be able to harvest content of single posts (or maybe posts-lists) as well as parts of the wordpress-generated web-page (all inside the <body>), like header or footer etc.

    For this I need to be able to offer an url where this app can get parts of a page to include in it’s own page.

    The app on a different server generates a html page and needs to be able to include elements from my wordpress install, something like this

    <div id=”header”>
    include: wordpress-content:
    –> <div class”whatever”><h3>anything</h3></div>
    include: wordpress-content:
    –> <div class”whatever2″><p>anything</p><p>lorem ipsum…</p></div>

    wherby the classes “whatever” and “whatever2” and all it’s content are parts of the regular wordpress output.
    Hope this pseudo-code makes it clear.

    Does anyone have some creative ideas?

    For now I thought of heaving fragments that are around the content as separated files which will be included in the theme files and therefore could be included from an external application just the same way. Of course local paths need to be full urls, but besides that, it shouldn’t be that difficult.

    For content blocks itself it should somehow be possible to use a special theme file which only creates the content-block without all the markup around.

    I’m not yet sure how I could define it. Maybe the functionality to create rss/atom feeds could somehow be adapted to create a html-fragment.

    I just would appreciate any ideas or hints or experiences.
    Just brainstorming-like thoughts would help a lot, because there might be much simpler solutions as I’m having in mind now or even some predefines wordpress functions I don’t know yet.

Viewing 3 replies - 1 through 3 (of 3 total)
  • I am not sure if I even understood what you want to do. But to get the content of a post you can run the post loop and place it inside paragraph html tags. Can you find a website that does something like what you are trying to achieve?

    Well, I think, I have to try a bit before I can get it explained much better.

    I just need to provide an URL (that WordPress generates) where an external tool can get for example a single post. But this external tool doesn’t need the whole page but only the fragment (div or whatever) that it should include in it’s own page.

    I have something similar but in the other direction realized here:


    Here WordPress is taking the contents of a shop to include it in it’s own page:

    In the sidebar on the right, way below, there is a header “NEUE ARTIKEL” and the list is imported from some URL at



    Forum Moderator

    Perhaps you need to look at integrating WordPress with your web site.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘creating html fragments, not full pages with wordpress for consumation by extern’ is closed to new replies.