WP-Postviews & Simple Edits

Community Forums Forums General Discussion WP-Postviews & Simple Edits

This topic is: not resolved

This topic contains 6 replies, has 4 voices, and was last updated by  mattgoyer 1 week, 5 days ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #28780

    mattgoyer
    Participant
    Post count: 4

    I’m trying to use the wp-postviews plugin with the Simple Edits plugin. What I’ve done is create a shortcode in my child theme’s functions file:

    function post_views() {
    return the_views();
    }
    add_shortcode(‘views’, ‘post_views’);

    But when I use the shortcode in Simple Edits post meta: [post_categories]  [views]

    It displays it on a different line that the post_categories. How do I get it to appear on the same line?

    Or if you have another way to show post views I’m all ears :).

    #30740

    weslinda
    Participant
    Post count: 193

    Do you have a link to this?  Did you figure this out?


    Loving the Genesis Life!

    #30763

    AC
    Blocked
    Post count: 7712

    Maybe try it this way – use the Meta snippets instead of the Simple Edits – http://my.studiopress.com/snippets/post-meta/.

    #31454

    mattgoyer
    Participant
    Post count: 4

    I haven’t solved it yet. Though Studiopress support had this to say:

    I’m not familiar with that plugin but my guess is the_views() automatically echos the content instead of returning it. You would need a function (possibly get_the_views()) that would return the value.

    #31677

    mattgoyer
    Participant
    Post count: 4

    Studiopress support was right. It was echoing it and not returning it. Adding a false to the function returns the value.

    So this now works for me:

    function post_views() {
    return the_views(false);
    }
    add_shortcode(‘views’, ‘post_views’);

    #123599

    rcorai
    Participant
    Post count: 1

    Hi Matt,

    I tried with the code you posted here but it doesn’t work for me. I’m seeing [views] tag instead of a number. Could you explain me a bit more how did you make it work?

    Thanks,

    #123608

    mattgoyer
    Participant
    Post count: 4

    Hi there, sorry but I don’t recall :(. /

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.