Support » Plugin: Post Views for Jetpack » Unable to install correctly
Unable to install correctly
-
Hi!
I just installed this plugin but I can not figure out how to automatically add it to all my posts. I managed to add the widget for total visit counts, and to add the shortcode to one of my posts, but I prefer to add it on all of them automatically. I know there is this code ( <?php echo do_shortcode(‘[jp_post_view]’); ?> ) , but I dont know where to place it in my theme.
Thanks in advance
The page I need help with: [log in to see the link]
-
Can I please get an answer to this? Or else the Plugin is useless to me
If you’d like the counter to be displayed in all your posts, you can place this code snippet in the
single.php
file orcontent-single.php
file that most likely comes with your theme.Another option would be to add the counter using a functionality plugin, and by adding a code snippet like this one to the functionality plugin:
function jeherve_add_counter_to_posts( $content ) { $post_views = sprintf( '<div class="sd-block stats_counter"><h3 class="sd-title">%1$s</h3><div class="sd-content">%2$s</div></div>', esc_html__( 'Views:', 'jetpack' ), esc_html( do_shortcode( '[jp_post_view]') ) ); return $content . $post_views; } add_filter( 'the_content', 'jeherve_add_counter_to_posts' );
If you don’t feel comfortable editing PHP files or writing PHP code, and if you need more help, I would recommend hiring a WordPress professional to get more help. You can do so here:
http://jobs.wordpress.net/Thank you for your reply.
So where exactly in my single.php file or content-single.php file can I add this code? I tried on a few places but it did not work.Two more questions:
1. How can I change the language? I would like it to be in Dutch.
2. I would like the counter to be placed in the top underneath each title, preferably in the place where you can now see “.. comments”. How can I do this?So where exactly in my single.php file or content-single.php file can I add this code? I tried on a few places but it did not work.
I would like the counter to be placed in the top underneath each title, preferably in the place where you can now see “.. comments”. How can I do this?
I am not familiar with your theme, so that’s something you will need to figure out on your own by figuring out how those files are organized and where the number of comments is displayed, for example.
How can I change the language? I would like it to be in Dutch.
You can submit translations for the plugin here:
https://translate.wordpress.org/projects/wp-plugins/post-views-for-jetpack/stable/nl/default/Once the translations you’ve submitted are approved and once the plugin is at least 95% translated into Dutch, translations will be automatically available to all Dutch WordPress sites.
So I translated every item to Dutch, can it be used now?
Now that you’ve suggested translations (thank you!), a member of the Dutch translation community will come along and look at your suggestions. Once they’re all approved you should see a new update available under Dashboard > Updates, offering you to download translations for the Post Views plugin. Once you’ve done so, you’ll have the translations on your site.
On my end, I’ve just pushed an update to the plugin to make sure it always uses translations you’ve submitted to WordPress.org, as soon as they’ve been approved.
Okay thank you. And when I activate the plugin again, how can I use the Dutch version? Will it go automatically?
Also I haven’t figured out where exactly to add the shortcode to place the views automatically on each blog, I asked my theme support but no reply yet. Do you maybe at least know in what theme folder it needs to be added?
when I activate the plugin again, how can I use the Dutch version? Will it go automatically?
Yes. In case you still see the English version, you can go to Dashboard > Updates and click on the button to update translations on your site.
I haven’t figured out where exactly to add the shortcode to place the views automatically on each blog, I asked my theme support but no reply yet. Do you maybe at least know in what theme folder it needs to be added?
That would depend on your theme, and how it is built and organized. I checked your site’s source code, and found that you are using a theme called Blossom. I downloaded it and had a look at it. You should be able to edit the file named
inc/template-functions.php
. On line 201 to 204, you’ll find the following:echo '<div class="entry-meta">'; blossom_travel_posted_on(); blossom_travel_comment_count(); echo '</div>';
Change this to the following:
echo '<div class="entry-meta">'; blossom_travel_posted_on(); blossom_travel_comment_count(); echo '<span class="views">'; echo do_shortcode( '[jp_post_view]' ); echo echo '</span>'; echo '</div>';
That should do the trick.
Thanks a lot for the good explanation!
The Dutch translations are indeed updated now.Also I added the code you provided, first it did not work but then I figured the
” echo echo ‘</span>’; ” needed to be ” echo ‘</span>’; ”
So it all works fine now! Thanks againOh yes, my bad, I repeated myself a bit 🙂
- The topic ‘Unable to install correctly’ is closed to new replies.