Support » Plugins » [Plugin: Custom URL] How to make pings into posts or display such

  • One of my sites is a million times easier for me to run as a microblog (ie status updates with only occasional full blog posts) so I’ve been using mjacob’s wonderful plugin to post these microblog posts to Facebook, Twitter and the blog all at the same time. (Love the auto-title feature, wish there was that option in normal WordPress.) I’ve been using it for about a year now and it’s just what I needed… almost.

    Here’s my problem: The “pings” post almost as their own little separate blog with their own separate feed (at I really want them to just be part of the main blog. I’ve been doing weekly digests of the pings to the main blog to make sure readers see them but its an inelegant solution. I’m not worried about the RSS end, I can combine the ping feed into the normal blog feed with pipes and feedburner, but I would really like all of those miniblog posts (pings, to use the verbiage of the plugin) to display as if they are real posts and part of the main blog. This way they’d not only show in all blog views (search, archive, categories, etc) but also be right alongside the “real” blog posts.

    In an ideal world, someone can advise me how to muck with the plugin so that it posts what it gets from as WordPress posts instead if pings.

    However, if that is impossible, if there is some way to fake it on the theme end and just have the pings display within the normal blog as if they were posts (even if they are still pings) I would accept that as a solution.

    (If someone’s already written up a tutorial on this, my apologies, I’ve Googled to no avail.)

    Thanks for your help in advance!

Viewing 15 replies - 1 through 15 (of 16 total)
  • One more thought, sorry: If there is a theme that is already optimized to do this, point me at it! I’m not overly attached to my current theme. 🙂

    There are a couple different ways to do this, but the preferred method is by updating your theme to show the custom post type used by my plugin. The link I sent you earlier via Twitter describes how to do that. You’ll have to swap out the main loop in your template with a customized loop that looks like this (code copied from the linked article):

    $args = array( 'post_type' => 'product', 'posts_per_page' => 10 );
    $loop = new WP_Query( $args );
    while ( $loop->have_posts() ) : $loop->the_post();
    	echo '<div class="entry-content">';
    	echo '</div>';

    Instead of 'post_type' => 'product', you can try 'post_type' => array('post', 'pingfm'). (Note: I haven’t tried this myself, so you might have to experiment until you get it how you want it.)

    The second way to do what you want would be to modify the actual plugin code so that everything gets inserted with a post type of ‘post’. This is less than ideal, though. You’ll have to do a DB update on your posts table to accommodate all the existing pings, and you’ll have to make the change every time you upgrade to a new version of the plugin.

    I would try the theme route first. 😉


    I’m going to try this over the weekend, Matt and see what happens. I’ll update with how it works.

    Appreciate your response!

    I was never able to get this to work quite right though I will say that it worked much closer to right with the default template then with any other. That said, it was close enough to working that I’m confident the method Matt prescribed would eventually work with enough tweaking.

    I am very thankful to Matt for both his wonderful plugin and his help in pointing me towards a solution.

    In the meantime, as there is more then one way to skin a cat as they say, I figured out a better way to do what I was trying to do in the first place. Namely to use a theme that was “aside” ready and import all of the pings in as aside posts. This way, moving forward, I actually don’t need to rely on pingfm at all (because I’m always a bit wary about trusting a 3rd party) and I can just micro-blog directly from within WordPress. I just wanted to mention this in case someone was in the same situation.

    Hi Matt, Hi hdepiano

    I’ve been struggling with this for long…I want to understand where do I need to do this editing…is it in loop.php which is available through Appearnace –> Editor in WordPress Admin ?

    And which part exactly needs to be swapped with the new code ?

    @hdepiano Which theme did the job for you ultimately…please tell as I’m in the same boat as you ?

    It all depends on how your theme files are organized, right? Not all themes share the exact same file layout, but most of them have index.php, comments.php, single.php, etc. See the wiki entry on Theme Development for more information. I want to help, but I can’t just do it for you.


    Hi Matt,

    I got a response from you via the other thread but could you please help me out by answering my question above ? Where exactly do I do this editing ? In WP Admin or at my Web host ?


    I added it to the index file and it mostly worked though you’ll tweak it a bit to get it to look right with your theme.

    It works best with the default theme but I believe, with enough work, it could work with any of them.

    To find a theme that is aside enabled, just search the theme section for “asides.” Twenty Ten is one of the most basic.

    Thanks for responding hdepiano

    Below are the contents of the index.php file for Twenty Ten theme. Can you please advise what has to be changed with what ?

    * The main template file.
    * This is the most generic template file in a WordPress theme
    * and one of the two required files for a theme (the other being style.css).
    * It is used to display a page when nothing more specific matches a query.
    * E.g., it puts together the home page when no home.php file exists.
    * Learn more:
    * @package WordPress
    * @subpackage Twenty_Ten
    * @since Twenty Ten 1.0

    get_header(); ?>

    <div id=”container”>
    <div id=”content” role=”main”>

    /* Run the loop to output the posts.
    * If you want to overload this in a child theme then include a file
    * called loop-index.php and that will be used instead.
    get_template_part( ‘loop’, ‘index’ );
    </div><!– #content –>
    </div><!– #container –>

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    This is obviously not ideal, but it might be the easiest thing for you at this point. In classes/PingFmCustomUrlUtils.php, look near line 13 and you should see this:

    const CUSTOM_POST_TYPE = 'pingfm';

    Change it to this instead:

    const CUSTOM_POST_TYPE = 'post';

    Don’t change anything else in that file. Save it and try a test ping. Everything should work like you want it to. Note: you’ll still have to update all your existing posts that have a post_type of pingfm. I think I posted the sample SQL update to do that in the other thread.

    Good luck!! Let me know how it works for you.


    Your last tip worked Matt…Thanks a bunch !

    Can’t we have a Radio button to readily do this in the next version ?

    Just wanted to add that, with the pingfm posting as posts, then it’s a simple matter of telling them to post to the designated aside category and use the post template for asides.

    @robbie_k Short answer: no.

    Long answer: prior to WP3, the notion of “post types” didn’t exist, and so there was a plugin preference to force everything from to be a normal post. (Status updates and micro-blogs were stored in their own DB table that the plugin created.) This was less than optimal for a whole bunch of reasons.

    WP3 introduced custom post types, and I updated my plugin accordingly. Now, status updates and micro-blogs are real, full posts as far as WP is concerned (no more separate DB table!), but their post type is different from posts that you would create yourself. However, WP3 gives us the tools necessary (custom queries) to act on those custom post types.

    Therefore, marshaling all posts into standard WP posts would be a step backward and semantically incorrect. That’s why I encouraged you to get the other solution working before showing you the easy way out. It’s easy, but it’s not the best technical solution in my mind.



    Thanks for your assistance on this issue and thanks for writing it in the first place.

    When I installed the plugin the posts weren’t displaying on our front page. I also couldn’t see them as the “miniblog” described by the original poster. If I knew the URL to , i could find it, but as with that person, I just want them to show up in the main feed.

    I implemented the solution given above to change CUSTOM_POST_TYPE from ‘pingfm’ to ‘post’. When I made the change, posts started displaying on our site. The problem is that the link on the title of each post is pointing to (which gets a wordpress-generated 404 error) but the post is actually located at

    Is there another simple change to make the link work?

    Thanks for your help…

    That’s interesting. Are you referring to new posts coming in since you made the change, or old posts that existed prior to making the code change above? The URL shouldn’t contain pingfm unless it’s a permalink to a status update posted from This sounds like it might be related to your permalink settings or your template.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘[Plugin: Custom URL] How to make pings into posts or display such’ is closed to new replies.