Site logo

Archived topic

Place counter php code before date and post autor in single.php?

6 replies · Started by NIKOLAY on April 19, 2020

Viewing posts 1–7 of 7

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.

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

This archived topic is closed to new replies.