WP-Postviews & Simple Edits

Community Forums Forums General Discussion WP-Postviews & Simple Edits

This topic is: not resolved

This topic contains 4 replies, has 3 voices, and was last updated by  mattgoyer 1 year, 3 months ago.

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

    mattgoyer
    Participant
    Post count: 3

    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

    anitac
    Participant
    Post count: 6988

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


    Let me help you customize your theme, responsive header, Buddypress, Agentpress or technical issue!
    Visit me here: Cre8tiveDiva.com | Tweet Me! | Plus Me!
    When asking for help, please provide a link or screen shot showing your problem!

    #31454

    mattgoyer
    Participant
    Post count: 3

    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: 3

    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’);

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

You must be logged in to reply to this topic.