Support » Plugin: Business Directory Plugin » [Plugin: Business Directory Plugin] Displaying specific sticky listing fields

  • Resolved canwild


    My previous question on this topic was marked as resolved but the suggested solution does not work in my situation. I have followed the instructions for “Matching the design to your theme” and this works fine for the regular listings. However, the sticky listings are generated by “function wpbusdirman_sticky_loop();” in “wpbusdirman.php” which performs an “echo wpbusdirman_post_excerpt();” and doesn’t allow you to template the individual fields of the sticky post separately in your theme like you can with the regular listings.

    The function “view_listings” in “views.php” uses “wpbusdirman_sticky_loop()” for the sticky listings which are then rendered using “echo wpbusdirman_post_excerpt();” and then renderes the regular listings using the “businessdirectory-listings.tpl.php” template. As a result, I am looking for a way to render my sticky listings in the same format as my regular listings.

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author businessdirectoryplugin


    Hi canwild,

    Yes, we need to expose a way for you to distinguish sticky/regular listings. You can do it through private metadata right now, but that’s not an entirely awesome way to go because we may change that in the future and break your code unintentionally (we already did that somewhere along the way between 1.0.8 and 2.0.x, which is how we discovered that with someone else’s template code).

    He was using this:

    $enhanced = get_post_meta($post->ID, '_wpbdp_sticky', true);

    which broke recently. So we need a better way to expose that to you to make it possible to alter the format conditionally. That way, you can render them in the same template, depending on the post type.

    Make sense?

    Yes, I ended up using get_post_meta($post->ID, "_wpbdp[sticky]", $single=true) for the search results and browsing by tag in my theme since these use the index.php template in my theme folder. These pages use a single loop. The View Listings and Category pages use two loops – one for the sticky listings and one for the regular listings – so these are trickier and also mess with the pagination. I ended up modifying the viewlistings function in views.php so it rendered them in a separate template.

    Perhaps it would be better to implement the “sticky” feature by sorting the listings on two fields – first on the sticky flag and then by date, count, author, or whatever. This might eliminate the need for two loops.

    Plugin Author businessdirectoryplugin


    Yeah, we’re working on it, but I hear what you’re saying. Glad it worked out.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: Business Directory Plugin] Displaying specific sticky listing fields’ is closed to new replies.