Rainer

count listings… and display on text widget

Hi there, I would like to publish the number of listings that are created on my website. So if some people add listings a new visitor could read that on my website are already xx listings... Is there any shortcode for this? cheers, Rainer

Created: February 25, 2014 at 9:01 pm
  • In: DirectoryPress
  • Started by: RainerRainer
  • 12 members left 40 comments
  • Last reply from: RamonRamon

  • Jason
    Jason
    April 26, 2018 at 1:30 am

    Am I adding that code above somewhere ?

    This returned

  • Aaron
    Aaron
    April 26, 2018 at 1:35 am

    I edited after I posted it – the post type should be “listing_type” not “post”:

    return wp_count_posts(‘listing_type’)->publish;

    This code below goes in your file:

    // Display published Listings using the shortcode [published-listings]
    function wb_published_listings() {
    return wp_count_posts('listing_type')->publish;
    }
    add_shortcode('published-listings', 'wb_published_listings');

    Mark has to fix this text-break in the forum lol.

  • Liz
    Liz
    April 26, 2018 at 2:02 am

    Why is this post showing as recent post ……… ?
    Indicating @Aaron responded to this thread 22 mins ago.

    This post is Old from 2014 (February 25, 2014 at 9:01 pm)
    It is now 26th April 2018 ……

  • Aaron
    Aaron
    April 26, 2018 at 2:11 am

    Why is this post showing as recent post ……… ?
    Indicating @Aaron responded to this thread 22 mins ago.

    It was updated on page 2 of this thread yesterday by a few users.

    Tested the code see attached pics:

    Attachments:
    You must be logged in to view attached files.
  • Aaron
    Aaron
    April 26, 2018 at 2:12 am

    And the result:

    Attachments:
    You must be logged in to view attached files.
  • Jason
    Jason
    April 26, 2018 at 2:22 am

    Aaron, Are the Australian buddy I spoke to on the phone in Sunny Queensland Australia, where all the Kangaroos, Koalas, Emus, Wallbies, Foxes & crazy wombats hang out ?

    About Liz, I wonder why she steps-in for no reason saying things like that, isnt facebook for that pmsl, lookin for a bone to pick with someone I guess.

    Anyways, Very good ole matey, that code above works good, time for a tiny lol

  • Aaron
    Aaron
    April 26, 2018 at 2:37 am

    No probs 🙂

    Plugin version is attached.

    Display published Listings using the shortcode [published-listings]
    and Categories with [published-cats]

    Attachments:
    You must be logged in to view attached files.
  • Liz
    Liz
    April 26, 2018 at 3:04 am

    no probs 🙂 sorry I thought the forum was broken, I’ve been seeing a few very outdated posts lately at the top, seeing as no dates are shown in actual posts 🙂
    It’s all good 🙂


  • Janak
    April 26, 2018 at 7:19 am

    26/4/18 – they need to fix this forum with the lack of dates, it’s ridiculous you only know the date of the last post and have no idea if the post before that it is a day old or 4 years old!
    How can people search the forum for meaningful information without dates on posts!

  • Ramon
    Ramon
    April 26, 2018 at 7:46 am

    Yes, this text br
    eaking problem
    is not exactly th
    e best advertise
    ment for buddyp
    ress, is it?


Viewing 11 posts - 31 through 41 (of 41 total)