E&T Filter: General Filter
Excerpts & Thumbnails' options can be overwritten by filters. Let’s consider an example.
As you can see below, the word_limit
option that is set in the backend is being overridden.
add_filter('wprss_template_extra_options', 'my_wprss_template_extra_options', 11, 3); function my_wprss_template_extra_options($options, $args) { $options['word_limit'] = 20; // Limit excerpts output to 20 words return $options; }
Other options that can be overridden this way include:
excerpts_enabled
- Corresponds to the Enable excerpts option;excerpts_ending
- Corresponds to the Excerpts ending option;excerpts_more_link_enabled
- Corresponds to the Enable "Read more link" option;excerpts_read_more
- Corresponds to the Read more text option.
How do I add this to my site?
Follow the step-by-step instructions below to add this filter to your WordPress site.
- Copy the code you need from above.
- Go to your WordPress site's dashboard.
- Go to Plugins > Add New.
- Search for Code Snippets, then install and activate the plugin.
- Once installed and activated, go to Snippets in your dashboard menu.
- Click on Add New.
- Add a Title, which could be the title of this article.
- Paste the code you copied in step 1 to the Code section.
- Add a Description or Tags if you wish to do so. It is not required.
- Click on Save Changes and Activate to save the filter and activate it.
- Or click on Save Changes to save the filter and activate it later.
- Your action or filter is now stored and active on your site.