Jump to content


Photo
- - - - -

WP-PostViews display count


This topic has been archived. This means that you cannot reply to this topic.
11 replies to this topic

#1 jankowalski

jankowalski

    Advocate

  • Members
  • 353 posts

Posted 16 August 2012 - 09:46 PM

Hey! I would like to display the number of views in the post byline information thanks to WP-PostViews plugin. WP-PostViews user guide says: 1) Open wp-content/themes//index.php 2) You may place it in archive.php, single.php, post.php or page.php also. 3) Find: 4) Add Anywhere Below It (The Place You Want The Views To Show): I found some instructions on this forum for platform pro, but it is very diferent to framework and do not apply. I understand I should use a "hook" but I don't know how to proceed. Can anyone tell me please? Thank you for your help.

#2 batman

batman

    Bat Learning

  • Members

  • 2218 posts

Posted 16 August 2012 - 10:37 PM

You can see this links to begin:

Please Login or Register to see this Hidden Content

Please Login or Register to see this Hidden Content

You can find Hooks

Please Login or Register to see this Hidden Content



#3 batman

batman

    Bat Learning

  • Members

  • 2218 posts

Posted 16 August 2012 - 10:50 PM

Now I copy you a rangelone??s example (he is one Moderator and ask you a live link in this "http://www.pagelines.com/forum/discussion/21347/hide-sidebar-for-individual-post-pages#Item_10" to help you better with your particular case, there are a lot of different code add and plugin installed in each user, it can modify the recommendation)
;)
The rangelone??s tutorial:

Please Login or Register to see this Hidden Content


Notice this first part:
add_action('brandnav_after_nav', 'brandnav_icons');
function brandnav_icons() { ?>

brandnav_after_nav is the hook. This is what determines where your desired content is placed. It's pretty easy to understand since hooks are named accordingly. In this case, brandnav_after_nav means that the content you place in this hook will be placed after the brand navigation. Does that make sense?

brandnav_icons is the name given to the content you want to add. You can name it however you'd like, but it's best to give it a descriptive name so that you know what it's for. This name is supposed to go in two places (as shown in the code above).

#4 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 17 August 2012 - 02:19 PM

@batman Thanks for posting rangelone's useful tutorial. :)

#5 batman

batman

    Bat Learning

  • Members

  • 2218 posts

Posted 17 August 2012 - 04:47 PM

@Catrina is a honor for me post all Catrina / simple_mama / Simon / Danny / rangelone / jamieb23 / beardedavenger ??s tutorials, always they are very usefull for me to keep learning. ;)

#6 catrina

catrina

    Advocate

  • Members
  • 12345 posts

Posted 17 August 2012 - 05:34 PM

:D

#7 jankowalski

jankowalski

    Advocate

  • Members
  • 353 posts

Posted 25 August 2012 - 04:32 PM

thanks for info. This is really useful. if there is any place where i can find those tutorials?
Anyway, i created this new function for my test purposes and it works ok

Please Login or Register to see this Hidden Content


now instead of creating new line i want to insert this content to metabar so how can i inset this into metabar?

#8 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 25 August 2012 - 06:45 PM

Using the Action Map, you can identify the proper elements to include in a hook that can be modified from what you wrote earlier.

Let me also point out the ShortCode Exec PHP plugin, which would take

Please Login or Register to see this Hidden Content

and convert it to a shortcode. You can add that shortcode into the metabar in Framework's Blog & Posts settings.

#9 jankowalski

jankowalski

    Advocate

  • Members
  • 353 posts

Posted 25 August 2012 - 06:56 PM

I used Action Map and i found pagelines_post_metabar but it doesn t show up. it only shows up when use: pagelines_before_postloop Thanks, ShortCode Exec PHP plugin makes the trick temporarily , however i don t want to install separate plugin for every functionality because it slows down my page. how can i write a function to add shortcode?

#10 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 25 August 2012 - 07:13 PM

That's an extremely light plugin and works very well in the background, quietly and with minimal impact. You can't convert a php snippet into shortcode without it. But once you do, I'm confident you'll be extremely pleased with the results. I think the code for including a shortcode in a function is do_shortcode() but I don't know how that's implemented. I'd suggest Googling it or searching the WordPress codex.

#11 jankowalski

jankowalski

    Advocate

  • Members
  • 353 posts

Posted 25 August 2012 - 07:17 PM

i already did it, and it works, thanks.

i tried to do it by code

Please Login or Register to see this Hidden Content



but didn t realize that php won t work. so i assume this is bad...??

Please Login or Register to see this Hidden Content


thanks

#12 Rob

Rob

    One Smart Egg

  • Members
  • 13575 posts

Posted 25 August 2012 - 07:21 PM

Honestly, I don't know. Worst case, if you try it and it doesn't, you know just what to fix or remove. But since you've accomplished your goal, is it worth experimenting? Glad you were able to get this done!