SMThemes Support » MiddleEarth
How can i display the author name into each post
8 years ago
x.kotos
Member
Hello,
i use the 'middleearth' theme. What i want is to display the author name using the following script ' <?php get_the_author_id(); ?>.'. Unfortunatelly the post.php is not clear. So, in which file may i put this script? thank you |
8 years ago
Dave
Support Service
Hi!
You need to edit theloop.php file that is lcoated inside the theme directory. Besides, if you enter the code after the line:
you don't have to find author id, simply use the code:
It will retrieve the author name. Here is function reference: https://codex.wordpress.org/Function_Reference/get_the_author |
8 years ago
x.kotos
Member
Hello,
On line 10 after i put the
The result is that no author name appears. If i put the whole script then is broken.Any solution? THanx |
8 years ago
Dave
Support Service
Yes, of course. If you insert this code into php you don't have to use open <?php and close this tag afterwords. Just use
If you insert this code into HTML code you have to write: |
8 years ago
x.kotos
Member
Hello,
In the 'theloop.php' file i put the code requested. Have a look at the first 12 lines: <?php global $post, $query_string, $SMTheme; $i=1; if (have_posts()) : if (!isset($_GET['ajaxpage'])) {?> <div class='articles'> <?php } while (have_posts()) : the_post(); ?><?php get_the_author(); ?> <div class='one-post'> As you can see i use html code like <?php get_the_author(); ?> However, if you look in a post like the http://xlomo.gr/wordpress/category/video-episkepton/ url, no author appears. Is there any conflict, or a missing option from backend? Thanx |
8 years ago
Dave
Support Service
Right you are! Sorry for inconvenience.
Please, insert the code:
Without "echo" you can't see the retrieved value. |
8 years ago
x.kotos
Member
thanx for help!
|
8 years ago
x.kotos
Member
Hi Dave,
I open this topic for the following clarrification. I am the administrator of the site and so in each page my author name appears. What i want is to appear the author name, which differs from my name, only in the following pages: -http://xlomo.gr/site/category/eikones-episkepton/ -http://xlomo.gr/site/category/video-episkepton/ That is, any other author name except from my name. Thank you |
8 years ago
Dave
Support Service
Hi!
I'm not sure how to change the post author in this case. You would better ask somebody on WordPress forum because this question is not related to a particular theme, but to the WordPress options. |
8 years ago
Dave
Support Service
Hi!
As I can see you have changed structure of html code and that's why some styles doesn't work for your website. Actually, we don't provide any services for editing themes for individual users paid or unpaid. Anyway, you need to use "z-index" along with "position" property to fix this issue. For example, for logo you need to replace the code:
with: |
8 years ago
x.kotos
Member
Hi Dave,
I'm afraid that your solution has to do with the styling whereas the issue is about the WordPress engine itself. So, i'll have a look at WordPress forums. Thank you for your feedback. |
Leave a reply
Search by forum
SMThemes.com Support
-
Categories
- Framework
- Themes
- Affiliate Company
- Sponsorship Useful pages
- How to start using our themes
- Contacts