Skip to content Skip to sidebar Skip to footer

How to add a column in the table of articles indicating the number of words

Search engine optimization (SEO) is a crucial step for any website looking to increase its visibility and generate more traffic. An important aspect of SEO is ensuring that your content is of high quality and relevant to your target audience. One way to measure the quality of your content is to analyze its word count. In this article, we'll show you a simple trick for tracking the word count of your posts in WordPress using the Evolurise_words_count() code function.

When creating content for your website, it's important to bear in mind that longer articles tend to rank higher in search engines. However, this doesn't mean you should fill your articles with superfluity just to increase the word count. Instead, you should seek to strike a balance between providing useful information and keeping your word count within a reasonable range.

What code should I add to my site?

The Evolurise_words_count() function is an excellent tool for tracking the word count of your articles. By adding a column to the list of articles in the administration table, you can easily see the number of words in each article. This allows you to quickly identify articles that are too short or too long and adapt them accordingly.

To use this function, simply copy and paste the code into your WordPress theme's functions.php file. Once you've done this, you'll see a new column called "Word Count" on the list of posts in the admin table. This column will display the word count for each post, allowing you to see at a glance which posts need adjusting.

function Evolurise_words_count()
// Add the column
function add_word_count_column($columns) {
$columns['word_count'] = 'Word Count';
return $columns;
}
add_filter('manage_posts_columns', 'add_word_count_column');
// Populate the column with the word count for each post
function show_word_count_column($name) {
global $post;
switch ($name) {
case 'word_count':
$word_count = str_word_count(strip_tags(get_post_field('post_content', $post->ID)));
echo $word_count;
}
}
add_action('manage_posts_custom_column', 'show_word_count_column');
}
//Call the function
Evolurise_words_count();

 

How do I add the code?

Adding this PHP function to your WordPress site is a simple process. Here are the steps to follow:

  1. Access the theme editor: In the WordPress dashboard, go to Appearance > Theme Editor. Make sure the theme you're currently using is selected in the drop-down menu on the right.
  2. Locate the functions.php file: On the right-hand side of the screen, find the file entitled functions.php. This file contains the functions used by your theme.
  3. Add the code: Paste the Evolurise_words_count() function code at the bottom of functions.php. Make sure there are no syntax errors, such as missing semicolons or braces.
  4. Save changes: Once the code has been added, click on the Update file button to save the changes.

You should now be able to see the word count column in the list of items in the administration table.

It's worth noting that before adding code to your functions.php file, it's always a good idea to back up your website and make sure you know what you're doing. Incorrect configuration can cause your website to malfunction.

By following these steps, you can easily add the Evolurise_words_count() function to your WordPress site and start tracking the word count of your posts to optimize your content for SEO.

By using the Evolurise_words_count() function, you can easily track the word count of your articles and make adjustments to optimize them for SEO. Remember, the aim is to provide quality content that is useful and relevant to your target audience. By keeping an eye on the word count of your articles, you can ensure that your content is up to scratch and ready to rank well in search engines.

Leave a comment

0.0/5