Introduction
In themes designed specifically for video content, a cap is placed on the total number of posts you can display in a single Content Widget. The primary reason for this is reliability. If we allow 30 video posts to load into the widget and you choose to use oembed for your video posts, that is 30 requests to your video host at the outset of your site load to retrieve the oembed data. This has a high probability of failure if the host is experiencing issues or high traffic, your server response is slow, or other issues interrupt the connection for any reason. The more video content loading on your homepage at once also may significantly increase your page load time.
If you still want to increase the cap, you will need to make a copy of the widget and modify the count.
This is considered a modification, and is provided as-is. We expect you understand what you are doing if applying coding changes using these or other WordPress tutorials. Make a backup of your existing file so you can replace it if something goes wrong and you need to start over. Modified files WILL probably be replaced by a theme update at some point, so keep note of your changes for future reference or see our guides below. We cannot assist you with modifying your theme or support problems you encounter as a result!
If you are modifying a theme as part of a client project, the following are really important!
How to Modify Your Theme the Right WayHow to Track Update Changes and Maintain Modifications
The Solution
- In an HTML editor on your computer, open the ocmx/widgets/content-widget.php
- Change the class name on lines 2, 4 and the last line. The class name is highlighted in the following example, and a unique version can be as simple as my_feature_posts_widget:
class obox_content_widget extends WP_Widget { /** constructor */ function obox_content_widget() {
And on the last line:
add_action('widgets_init', create_function('', 'return register_widget("obox_content_widget");'));
- Save the file with a unique filename, such as mycontent-widget.php
- Scroll down to the bottom to locate line 252 and change 13 to your desired cap:
<?php $i = 1;
while($i < 13) :?>
- Save again and upload to wp-content/themes/yourtheme/ocmx/widgets using an FTP client or your hosting control panel.
If you plan to make other modifications, consider using a child theme to make managing theme updates and your mods easier: