1

enter image description here

I have added a testimonial slider in WordPress Page but It is showing the dots at the bottom but I want the author name in place of dots. Can any one help me in this. I have also attached the UI sample.

  • I don't see any dots. – Reza Saadati Jul 13 '18 at 12:48
  • what solution did you use for the slider? Can you post your slider code? – Ovidiu Jul 13 '18 at 12:48
  • @RezaSaadati In my current UI I have the dots, now I want to convert the dots to the author name. –  Jul 13 '18 at 12:52
  • @Ovidiu, I have made the slider using elementor and It is showing the dots. Now I want to convert that dots to the author name as In the image. –  Jul 13 '18 at 12:53
  • I do not know elementor. If you would've created it via code, not a page builder, you could've replaced the html for dots with custom html for authors. Since I do not know elementor, maybe somebody else knows how to tweak it or stuff. Cannot help at this moment. But please make sure you update the question to reflect that you are using a slider built with elementor. – Ovidiu Jul 13 '18 at 13:12

1 Answers1

2

Use the Wordpress function get_the_author_meta().

E.g. echo get_the_author_meta('first_name') . ' ' . get_the_author_meta('last_name'); will output the first name and the last name of the author. Instead of firstname and lastname, you could use following strings as parameter:

  • admin_color
  • aim
  • comment_shortcuts
  • description
  • display_name
  • first_name
  • ID
  • jabber
  • last_name
  • nickname
  • plugins_last_view
  • plugins_per_page
  • rich_editing
  • syntax_highlighting
  • user_activation_key
  • user_description
  • user_email
  • user_firstname
  • user_lastname
  • user_level
  • user_login
  • user_nicename
  • user_pass
  • user_registered
  • user_status
  • user_url
  • yim

Now that you have the data, you need to replace the dots (...) with the data. Let's say the plugin that you are using does not support it and you don't want to edit the codes of your plugin. You could still use JavaScript!

PHP: Just output the value in a div with a class.

JavaScript: Then replace the selector of your dots (...) with the selector of the div that you have given.

E.g.:

document.querySelector('.dots').innerHTML = document.querySelector('.hidden-author').innerHTML;
.hidden-author {
  display: none;
}
<div class="hidden-author">Author's name</div>
<div class="dots">...</div>
Reza Saadati
  • 5,018
  • 4
  • 27
  • 64
  • I just want to know that where to add the php and html code Like in which file I can add the code (HTML & PHP) –  Jul 13 '18 at 13:56
  • @Raghav it depends on your theme. JavaScript you could simply add to your JavaScript file and the PHP code into that file that will be loaded from your theme. – Reza Saadati Jul 13 '18 at 14:00