Archived topic
Place counter php code before date and post autor in single.php?
6 replies · Started by NIKOLAY on April 19, 2020
Hello,
I'm trying to place php code which count each reload of each post in my web site.
In my old theme I place the php code just before publish date and post autor (after tilte in single.php file of theme).
The php code is: <?php echo_views(get_the_ID()); ?>
I'm tring to use hook for single post after tiltle and it is work well.
Is it possible to place on same row as date and autor instead before them after title?
Regards: Nick
Hi there
can you link me to a post where i can see this ? Maybe a simple CSS fix.
Here is what I want
-> https://elhovo.news/wp-content/uploads/2020/04/Clipboard01-1.jpg
The web page is https://elhovo.news
Thanks
Could you wrap your function in a DIV like so:
<div class="post-views"><?php echo_views(get_the_ID()); ?></div>
Then add this CSS:
.single .entry-meta, .post-views {
display: inline-block;
margin-right: 1em;
}
.post-views font {
font-size: 85% !important;
}
It is stay still bellow data and post autor
I did all in one line with hook -> counter php + date + category and did not use theme date and author...
Thanks for your help
Glad to hear you found a solution