Limit number shown

I want to see if it is possible to limit the amount of backups that is shown for example, as I one of the websites has a backup every week, so I need to be able to limit it to 5 or 10 for example in the template.

I tried looking through all documentation but couldn’t find anything for it. Is this possible? I noticed there were some other posts that asked this but with no solution.

Hey @Kai

Not out-of-the-box, but you can add a couple of lines to the PHP file of the report template to achieve this.

In the Backups Data section, attach a CSS ID to the body of the table, as so:

And then, in the <style> section, at the top of the PHP file, add this CSS:

		#backuptable tr { display:none; } 
		
		#backuptable > tr:nth-child(-n+5){ 
			display: table-row; 
		}

In this example, the CSS ID is backuptable and (-n+5) determines that the 5 rows of the table will be displayed.

You can find more information on customizing the PHP file of the report templates in this help document:

This works in the preview, but when I download the pdf, they are all hidden, instead of 5 showing. Any reason this is? Maybe the PDF exporter on MainWP doesn’t support nth-child?

Found the solution. The above didn’t work and it seems to be because it doesn’t like (-n+5) but if you decide to go the other way and hide all but first five with (n+6), it works fine.

#backuptable tr:nth-child(n+6) {
        display: none;
    }

I’m glad you found the solution. However, the PDF was properly displaying the first 5 entries with (-n+5) for me.

Please take a look if you are running the latest version of Pro Reports (4.0.11).

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.