{"id":5104,"date":"2023-09-13T10:04:27","date_gmt":"2023-09-13T08:04:27","guid":{"rendered":"https:\/\/bureaumaas.com\/leestijd-indicator-toevoegen-in-wordpress-stap-voor-stap-handleiding\/"},"modified":"2025-07-26T12:35:03","modified_gmt":"2025-07-26T10:35:03","slug":"leestijd-indicator-toevoegen-in-wordpress-stap-voor-stap-handleiding","status":"publish","type":"post","link":"https:\/\/bureaumaas.com\/en\/leestijd-indicator-toevoegen-in-wordpress-stap-voor-stap-handleiding\/","title":{"rendered":"Leestijd Indicator Toevoegen in WordPress [Stap-voor-Stap Handleiding]"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Introduction<\/h3>\n\n<p>A reading time indicator is a helpful feature that gives your readers an idea of how long it will take to read an article. In this tutorial, we\u2019ll show you how to add a simple reading time indicator to your WordPress posts using a custom code snippet in your theme\u2019s functions.php file. This indicator will automatically calculate the reading time based on the number of words in your post and display it at the bottom of the article.  <\/p>\n\n<h3 class=\"wp-block-heading\">The Code Snippet<\/h3>\n\n<p>Here is the code snippet you need to place in your theme\u2019s functions.php file:<\/p>\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:block;padding:16px 0 0 16px;margin-bottom:-1px;width:100%;text-align:left;background-color:#2e3440ff\"><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"54\" height=\"14\" viewbox=\"0 0 54 14\"><g fill=\"none\" fill-rule=\"evenodd\" transform=\"translate(1 1)\"><circle cx=\"6\" cy=\"6\" r=\"6\" fill=\"#FF5F56\" stroke=\"#E0443E\" stroke-width=\".5\"\/><circle cx=\"26\" cy=\"6\" r=\"6\" fill=\"#FFBD2E\" stroke=\"#DEA123\" stroke-width=\".5\"\/><circle cx=\"46\" cy=\"6\" r=\"6\" fill=\"#27C93F\" stroke=\"#1AAB29\" stroke-width=\".5\"\/><\/g><\/svg><\/span><span role=\"button\" tabindex=\"0\" data-code=\"function leestijd_weergeven_shortcode() { $content = get_post_field('post_content', get_the_ID()); $woordenteller = str_word_count(strip_tags($content)); $leestijd_minuten = ceil($woordenteller \/ 200); \/\/ Gemiddeld leestempo is 200 woorden per minuut if ($leestijd_minuten == 1) { $leestijd = '1 minuut leestijd'; } else { $leestijd = $leestijd_minuten . ' minuten leestijd'; } return '&lt;div class=\"leestijd\"&lt;encoded_tag_closed \/&gt;' . $leestijd . '&lt;wpml_invalid_tag original=\" pc9kaxymz3q7jzsgfsbhzgrfc2hvcnrjb2rlkcdszwvzdglqzf93zwvyz2v2=\"\" zw4nlcanbgvlc3rpamrfd2vlcmdldmvux3nob3j0y29kzscpoyaiihn0ewxl=\"\" psjjb2xvcjojzdhkzwu5zmy7zglzcgxhetpub25liibhcmlhlwxhymvspsjl=\"\" b3bpzwvyiibjbgfzcz0iy29kzs1ibg9jay1wcm8ty29wes1idxr0b24ipg=\"=\"\"><\/span><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewbox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2m-6 9l2 2 4-4\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M9 5H7a2 2 0 00-2 2v12a2 2 0 002 2h10a2 2 0 002-2V7a2 2 0 00-2-2h-2M9 5a2 2 0 002 2h2a2 2 0 002-2M9 5a2 2 0 012-2h2a2 2 0 012 2\"><\/path><\/svg><\/span><pre class=\"shiki nord\" style=\"background-color: #2e3440ff\" tabindex=\"0\"><code><span class=\"line\"><span style=\"color: #81A1C1\">function<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">leestijd_weergeven_shortcode<\/span><span style=\"color: #ECEFF4\">()<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">content<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">get_post_field<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">post_content<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> get_the_ID<\/span><span style=\"color: #ECEFF4\">())<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">woordenteller<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">str_word_count<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #88C0D0\">strip_tags<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">content<\/span><span style=\"color: #ECEFF4\">))<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd_minuten<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #88C0D0\">ceil<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">woordenteller<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #81A1C1\">\/<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #B48EAD\">200<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #81A1C1\">;<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #616E88\">\/\/ Gemiddeld leestempo is 200 woorden per minuut<\/span><\/span>\n<span class=\"line\"\/>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">if<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd_minuten<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">==<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #B48EAD\">1<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">1 minuut leestijd<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">else<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">{<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">        <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">=<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd_minuten<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">.<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\"> minuten leestijd<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D8DEE9FF\">    <\/span><span style=\"color: #81A1C1\">return<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">&lt;div class=\"leestijd\"&gt;<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">.<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">$<\/span><span style=\"color: #D8DEE9\">leestijd<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #81A1C1\">.<\/span><span style=\"color: #D8DEE9FF\"> <\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">&lt;\/div&gt;<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"><span style=\"color: #ECEFF4\">}<\/span><\/span>\n<span class=\"line\"><span style=\"color: #88C0D0\">add_shortcode<\/span><span style=\"color: #ECEFF4\">(<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">leestijd_weergeven<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #ECEFF4\">,<\/span><span style=\"color: #88C0D0\"> <\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #A3BE8C\">leestijd_weergeven_shortcode<\/span><span style=\"color: #ECEFF4\">'<\/span><span style=\"color: #ECEFF4\">)<\/span><span style=\"color: #81A1C1\">;<\/span><\/span>\n<span class=\"line\"\/><\/code><\/pre><\/div>\n\n<h4 class=\"wp-block-heading\">Follow the steps below to add the code. <\/h4>\n\n<ol class=\"wp-block-list\">\n<li><strong>Go to your WordPress dashboard:<\/strong> Log in to your WordPress dashboard using your username and password.<\/li>\n\n\n\n<li><strong>Navigate to the Theme Editor<\/strong>: In the dashboard, click on \u201cAppearance\u201d and then on \u201cTheme Editor.\u201d<\/li>\n\n\n\n<li><strong>Locate the<code>functions.php<\/code> file:<\/strong> On the right side of the screen, you\u2019ll see a file named<code>functions.php<\/code>. Click on it to open it for editing. <\/li>\n\n\n\n<li><strong>Add the code:<\/strong> Scroll all the way to the bottom of the <code>functions.php<\/code> file. Paste the previously provided code snippet at the very end of the file. <\/li>\n\n\n\n<li><strong>Save the changes:<\/strong> Click the \u201cUpdate File\u201d button to save your changes.<\/li>\n<\/ol>\n\n<h3 class=\"wp-block-heading\">Explanation of the Code<\/h3>\n\n<ul class=\"wp-block-list\">\n<li>In this code, we use the function <code>leestijd_weergeven()<\/code>to calculate the reading time of a post.<\/li>\n\n\n\n<li>We retrieve the content of the post using<code>get_post_field()<\/code>.<\/li>\n\n\n\n<li>Next, we count the number of words in the content and divide it by 200, which represents an average reading speed of 200 words per minute.<\/li>\n\n\n\n<li>We round the calculated reading time up to the nearest whole minute.<\/li>\n\n\n\n<li>Depending on the reading time, we display either \u201c1 minute read\u201d or \u201c[number] minutes read\u201d in an HTML div.<\/li>\n<\/ul>\n\n<h3 class=\"wp-block-heading\">How to Use the Snippet within Elementor<\/h3>\n\n<ul class=\"wp-block-list\">\n<li>After placing and saving the code in the functions.php file, go to your WordPress dashboard.<\/li>\n\n\n\n<li>Click on \u201cPosts\u201d and open the post where you want the reading time indicator to appear.<\/li>\n\n\n\n<li>Edit the post with Elementor.<\/li>\n\n\n\n<li>Add a Text widget or any other widget where you want the reading time indicator to appear.<\/li>\n\n\n\n<li>Place the shortcode inside the widget.<\/li>\n\n\n\n<li>Update your post and preview it. You will now see the reading time indicator in your post. <\/li>\n<\/ul>\n\n<h3 class=\"wp-block-heading\">Conclusion<\/h3>\n\n<p>Congratulations! You\u2019ve successfully added a reading time indicator to your posts. This will help your readers estimate how long it will take to read your articles. You can place this shortcode wherever you like, but we recommend adding it to a single post template so you only need to insert it once.    <\/p>\n\n<p>Show us your result! <\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to easily add a reading time indicator to your Elementor posts to help your readers estimate how long it will take to read your articles.<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-5104","post","type-post","status-publish","format-standard","hentry","category-onderhoud"],"_links":{"self":[{"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/posts\/5104","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/comments?post=5104"}],"version-history":[{"count":1,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/posts\/5104\/revisions"}],"predecessor-version":[{"id":5105,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/posts\/5104\/revisions\/5105"}],"wp:attachment":[{"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/media?parent=5104"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/categories?post=5104"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bureaumaas.com\/en\/wp-json\/wp\/v2\/tags?post=5104"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}