The MU forums have moved to WordPress.org

Append each post in MU with particular php code/text (8 posts)

  1. MortenBlaabjerg
    Member
    Posted 15 years ago #

    I want all posts in our MU install to contain and render a piece of PHP code at the time of their creation. Or more desirably, all posts of the admin-chosen blogs (activated per blog basis).

    All posts in the system are syndicated using FeedWordPress.

    The killer feature I want is this : At the time of FWP syndication/creation of each syndicated post I want to burn into the flesh of that post the permalink of it's source, along with the author and source site information supplied by FWP's API, accessible via PHP. I also want to add links to a terms of use page, disclaimer and other such information.

    The point is I want that information to remain with the post with each further syndication of the post, performed by niche sites in our MU setup, which syndicate posts from our _main_ site per category and tag.

    Found and tested a lot of plugins, but none seem to fit the bill. I tried plugins which allow PHP in posts, but this works only it seems for posts which are actually written in the WP-admin area. I tried RSS-append and Footer-append plugins, but most plugins are cosmetic. They don't leave any footprints on the original post, and so none are transported along with the post when it is syndicated (again).

    I can't keep this on a cosmetic level (i.e. in the skin) because I want the information (i.e permalinks etc) transported even beyond our site network, to our customers' own sites and networks, when they retrieve our feeds. So that their readers will easily be able to get to the original source of the articles (and see the 'terms of service' etc. after each post)

    My thought is this : for something as simple as appending a piece of code to every post in the MU system, there must be an easy method?

    Anyone who knows of a plugin or a combination of plugins, which may achieve said result?

    I'd be grateful for just a few insights on how to achieve this with WPMU.

    On a sidenote, WP-o-Matic, the other aggregator plugin for WordPress, very easily appends all the desired information to every post in a "campaign". Unfortunately we can't use WP-o-Matic as timestamps of syndicated posts are unreliable with this plugin, and these are important to us to maintain proper chronology in our system.

  2. MortenBlaabjerg
    Member
    Posted 15 years ago #

    The PHP code I want to append to each syndicated post (on it's first syndication) looks something like this :

    <p class="feed">From <?php the_author_posts_link()?><?php
    if (is_syndicated() and (get_the_author() !== get_syndication_source())):
        echo ', <a href="';  the_syndication_permalink(); echo '">';
        the_syndication_source();
        echo '</a>';
    endif; ?>
  3. andrea_r
    Moderator
    Posted 15 years ago #

    Add it to the feed code itself? Look at the plugin "Better Feed by Oz" which adds extra bits to a feed.

  4. MortenBlaabjerg
    Member
    Posted 15 years ago #

    Thanks! :-) I've taken a look at the plugin you mention. I could be wrong, but it seems it simply appends the information to the feed posts, and the information does not _actually_ get appended to each post in the database. This is also the case with other "feed_footer" type plugins I tried. The information is not conveyed, say, when the feed item is syndicated into another site as a regular post.

    This type of solution could work for me, only if the PHP code is executed correctly to append the resulting HTML correctly to the post, and when syndicated and re-published posts will carry the information across, so that the information stays with the post on subsequent platforms.

    This seems like too much trouble compared to executing some PHP and writing the resulting HTML directly to the WP database. I'd prefer to have the information directly in the post content, not outside of it, as I cannot be certain how posts will be dealt with at the receiving end. The PHP code should be executed when the post is created, and the resulting HTML included in the post content.

    For clarification, our setup looks like this :

    Source -> Syndication1 -> Syndication2 -> Etc.

    At Syndication1 source posts are re-published to our main site via FeedWordPress. At Syndication2 posts are fed from Syndication1 per category/tag and re-published via FeedWordPress. It's here and at subsequent syndications we have the problem. The permalink given by FWP will of course point to the previous site in the chain.

    Therefore, to make sure that readers of the post on subsequent sites will be able to get directly to the source without travelling through a long chain of backlinks, I'd like to inscribe the original source directly into the post content. We'll have to add this to the post at Syndication1 level, where we'll get the right values for the permalink.

  5. andrea_r
    Moderator
    Posted 15 years ago #

    Guess you'll have to get coding.

  6. MortenBlaabjerg
    Member
    Posted 15 years ago #

    Was hoping to find a plugin which had already worked out how to append stuff to the database posts - on either a global MU scale or on a per-blog scale.

    But if none exists, we'll have to develop one of our own. It would still be nice to have something to concept-test things with before we do create our own plugin.

  7. MortenBlaabjerg
    Member
    Posted 15 years ago #

    Even if I am to develop this plugin myself, I'd really appreciate some pointers based on your experience, on where to start and particulars to be aware of.

    Posted this also in the regular WP forums now, as it is more of a plugin-topic than a MU-specific topic (although I imagine MU users would need a plugin for this more than others) : http://wordpress.org/support/topic/211069

  8. rizapn
    Member
    Posted 15 years ago #

    Why don't you try to look at Donncha WordPress MU Sitewide Tags Pages (http://ocaoimh.ie/wordpress-mu-sitewide-tags/). I use that plugin to create our own MU syndication site (one single site which has all other users post).

About this Topic

  • Started 15 years ago by MortenBlaabjerg
  • Latest reply from rizapn