Using MarketPress with Pippin Williamson's Better Related Posts Widget

I am using MarketPress with Headway theme. I've run into a problem with Pippin Williamson's Better Related Posts Widget (paid plug-in, available at CodeCanyon) that I can't resolve. I'm posting the details in the hope that someone can help.

Some background: I've been using Pippin Williamson's Posts by Taxonomy Widget Pro and Better Recent Posts Widget Pro (both also premium plug-ins) and both are working fine for me. Both recognize MarketPress's product custom post type and the associated taxonomies. Similarly, Better Related Posts works fine for me if I use it on a post page (and specify standard post type and post taxonomy, such as category), and it works fine for me with an FAQ widget (and specify the FAQ custom post type and associated FAQ taxonomy).

The problem is this: When I use Better Related Posts with a MarketPress product page and specify the product custom post type and the product_category taxonomy, it displays nothing. No matter what other choices I make in the widget, it displays nothing at all -- not even the title of the widget. (Other widgets in the same sidebar -- such as the shopping cart and Better Recent Posts, do display properly.) As with standard posts and FAQs, the widget clearly recognizes and allows me to select the proper post type (product) and the taxonomy (product_category). But nothing displays, even though I know there are products that should display.

So, summary so far: Pippin's Posts by Taxonomy Widget Pro and Better Recent Posts Widget Pro both work OK with MarketPress. Pippin's Better Related Posts works fine with standard posts and FAQ custom post types. But Better Related Posts does not function properly with MarketPress's products (even though it clearly recognizes and lists MarketPress's product post type and related taxonomies).

The one major difference between the first two plug-ins and Better Related Posts is that Better Related Posts needs to read the taxonomy of the custom post type (product, in this case) displayed on the page. I know that the taxonomies are there, because I can see them displayed at the bottom of the product (or post or FAQ) listing. But it appears that Better Related Posts cannot read the product taxonomy and thus displays nothing.

As noted, Better Related Posts has no problem reading the taxonomies of standard posts and FAQ custom post types. But it fails to read them, apparently, on product pages. Since it fails to read them only with MarketPress's products, I surmise that Better Related Posts is making the right queries but there's something different (non-standard?) about the way MarketPress's products indicate their taxonomies -- ie, product categories or product tags -- that prevents Better Related Posts from acquiring this information.

In discussing all this with Pippin, we agree on the possible/probable cause of the problem as described above, and he suggests (since I'm not a programer) that I ask this question: "Is there anything that the developers have done with the custom product taxonomies that would make it so that plugins have a hard time reading them?"

All software mentioned here is the most recent version. I'm working at the moment on a locally hosted test site, so I can't point to a page at the moment to "show" the problem. Not really sure how to "show" the problem (which is an empty space) anyway. I run the local host on a Mac running Lion, use Headway theme as mentioned above, and test on Chrome. For "official" tech support people, if you are out there, Pippin has given me permission to email you a copy of his Better Related Posts widget for testing and troubleshooting if that is of help. Any and all assistance in resolving this is greatly appreciated!

  • Philip John

    Hiya Robert,

    Thanks for such a detailed post first of all, it's rare we get so much info and it really helps!

    As far as I am aware MarketPress uses completely standard methods for creating custom types and taxonomies so the plugin should be able to pick up those just like any other.

    Can you send the copy of the plugin to for me and I'll do some testing myself?


  • Robert


    Thanks for taking the time to look this over. I am, however, stumped by your reply, and don't understand what you're trying to say.

    Let me recap: Pippin Williamson's Better Related Posts, like many of his other plugins, is specifically made to work with custom post types. If you look at the Better Related Posts plugin page


    you'll see that he mentions "custom post type support" and use with "any custom taxonomy" a number of times. I have also tested the plugin with other custom post types and their associated taxonomies and the works fine and as advertised with them.

    So when you say that Better Related Posts "doesn't actually support custom posts", I don't understand what you mean. The only custom post type I can't get it to work with is MarketPress's product. In all other cases (ie, custom post types), it has worked fine for me.

    So in what way does Better Related Posts "not support" custom post types. Can you be more precise about what Better Related Posts doesn't do that you think it should do? Can you explain why Better Related Posts DOES work with other custom post types but DOES NOT with MarketPress's products?

    I wonder if you are misunderstanding the purpose/function of the plugin. Might I suggest you look at the video on the above mentioned plugin page to what Better Related Posts is designed to do -- just to make sure we are all on the same page.

    I am sending your reply to Pippin so he can try to understand what you're saying. But I wonder if it makes sense and would be more efficient for the two of you to communicate directly. Can I send him your contact info?


  • Robert


    I sent Pippin your analysis of the situation, and for the record, here is his reply:

    "His response is completely wrong. The plugin detects the post type of the currently displayed post and pulls in other items of the same post type. If he had actually looked at the code he would see that."

    I will be contacting you via email with Pippin's contact info so that you two can, I hope, sort this out. It would be great to get Better Related Posts and MarketPRess to work together correctly, and to be able to announce that fact here in the forum.

  • wecreateyou

    Wow... I like Pippin's stuff, but that response has a negative tone IMHO. It's not always what you say, but sometimes it's how you say it.

    The issue might be linked to another post where it says that Marketpress has an _underscore at the beginning of the post type name or something like that. (If I can find the post I'll share it with you Phil) Maybe Aaron will recall this if you mention it too him and he can rule it out or confirm it as the issue.

    Hope this helps to have this info... At least that is my intention.


  • Robert


    I have installed and tested WPMU's Recent CPT widget as you requested. And yes, it works fine and as advertised. But, unless you're asking to determine if there is some basic problem, such as with my theme (Headway), I'm really not sure why you are asking me this. So some comments:

    1. WPMU's Recent CPT simply looks for the CPT designated in the widget and returns with a listing of same. No problem here, it works fine for me. Pippin's Better Recent Posts Widget Pro does the same thing, only with more and better specificity, and it also works no problem. In Pippin's plugin, I can specify a particular CPT taxonomy (in our case, product_category or Product_tag) and filter by category or tag ID (or IDs), and that works fine for me.

    2. Pippin's Better Related Posts is a rather different animal from either his or WPMU's "Recent " widgets. Better Related Posts has to look at the post displayed on the page and determine that post's taxonomies, rather than having me tell it about the taxonomies in the widget (as in Better Recent Posts Widget Pro). To repeat, WPMU's Recent CPT and Pippin's Better Recent Posts Widget Pro don't do this; only Better Related Posts must determine the taxonomies to display on its own. Only after doing this does Better Related Posts filter posts (by the taxonomies it has found in the displayed post) and list them. Testing the "Recent " widgets does tell us that, in very basic terms, CPTs are set up and working properly, but it doesn't tell us why Better Related Posts isn't working with MP's product CPT taxonomies.

    3. Just a reminder that Pippin's Better Related Posts does work properly with other CPTs and their taxonomies. In my testing, it only fails to work with MP's product CPT.

    Your question makes me concerned that we are still not yet on the same page, that you have not yet grasped the distinction between a "recent posts" widget and a "related posts" widget (which, as far as I can determine, WPMU does not offer). Perhaps my comments above have helped to clarify that.

    Please let me know if there is anything else I can do to help this along. I look forward to getting this resolved. Pippin's Better Related Posts is a great widget, an excellent enhancement for MarketPress, and so far does not duplicate or compete with anything offered here at WPMU. It would be great to get it working correctly with MP.

    Thanks for your help so far.

  • Robert


    I've been keeping Pippin up-to-date on the comments in this thread. (And a quick thank-you to wecreateyou for his tip about the underscore.) I sent him our most recent recent back and forth from this morning, and his reply was this:

    "I'm confident it's definitely a problem with MP. Ask them this: Is there any reason that using get_post_type() on the currently displayed post would not pull in the post type of the product?"

    I have my fingers crossed we can figure this out, with you two and me, the non-programmer, as go-between.

  • Philip John


    First off what I think we've already established here is that MarketPress is working as expected; it's creating the post type, custom taxonomies and displaying as it should on the site. Therefore, MP is not malfunctioning in anyway and so I don't consider this to be a problem with MP. We don't support issues with 3rd party plugins but I'm keen to help you sort it out. I'd appreciate if your tone was more reflective of this.

    Asking you to check that the Recent CPT widget worked was part of a logical process of elimination to ensure that the CPTs were discoverable, which they are.

    I've taken another look at the code and I can now see why the widget isn't appearing on MarketPress product pages.

    The widget only appears if is_single() is true (line 39). This assumes the post is using the single template, which isn't always going to be the case.

    Removing this check makes the widget appear.


  • Robert


    First off, sincere apologies for any offense I may have caused. It certainly was not intentional. As both a non-programmer and a user "caught in the middle", I was in a bit of a panic that the conversation was either heading off on a tangent or was going to end unresolved. I thought I had my emotions under control -- but I guess not. Again, apologies. You do a yeoman's job here on the forum. I know you are going out of your way to help and am very happy to hear that you are keen to get this fixed -- and for all that I am most grateful. And now that you've explained the reasoning behind your request, I understand the logic behind the Recent Custom Posts test you asked me to do as well. (I know almost nothing about PHP, but I am pretty good at the logic of troubleshooting.)

    So, on to the issue at hand. Good news about "if is_single() is true (line 39)". I don't understand why the page wouldn't be based on a single template, but that's probably due to my ignorance more than anything else. It would explain, however, why the entire widget is missing (ie, not even the widget title appears), instead of just the widget's content. I will pass this on to Pippin in case you haven't already.

    Two items of uncertainty here for me:

    1. When you say that "removing this check makes the widget appear", does the widget as a whole work correctly now, or does just the widget title appear, and we still need to determine why the content does not?

    2. I'd like to experiment with removing the "offending" code myself and see what happens. But in looking at line 39 and environs, I'm having a hard time matching the corresponding { with } and "<?php" with "?>" and determining what I can remove without breaking the code. Can you tell me exactly what I should delete?

    Again, thanks for your help. It looks like we're nearly there.


  • Robert

    I just now made a few attempts at deleting "if is_single() is true (line 39)" on my. My initial assumption -- that there were a number of associated lines that also needed to be deleted -- all met with failure. So I just tried deleting just the if statement and nothing else. And it worked! So I guess I answered my own question. And I'm good to go.

    Thanks, Phil, for all your work on this. Much appreciated.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.