WordPress.org

Ready to get started?Download WordPress

Forums

Business Directory Plugin
[resolved] Displaying specific sticky listing fields (4 posts)

  1. canwild
    Member
    Posted 2 years ago #

    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.

    http://wordpress.org/extend/plugins/business-directory-plugin/

  2. businessdirectoryplugin
    Member
    Plugin Author

    Posted 2 years ago #

    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?

  3. canwild
    Member
    Posted 2 years ago #

    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.

  4. businessdirectoryplugin
    Member
    Plugin Author

    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.