So is PKCS7 a signature format or a certificate format or both?
Neither. PKCS7 is now Cryptographic Message Syntax(CMS). From the RFC 5652:
This
syntax is used to digitally sign, digest, authenticate, or encrypt
arbitrary message content.
CMS enables interoperability between different products which can operate on the same document without knowing anything about other product (implementation and such other specific info related to the product). CMS achieves this by defining specific message formats for each data type (signed data, enveloped data, authenticated enveloped data). Hence, each product which support CMS format can exchange files or messages defined in the CMS format with no trouble.
The second link you provided also talks about CMS format.
After comments from @Maarten:
It is also worth to mention that PKCS stands for "Public Key Cryptography Standards". These are a set of public key cryptography standards created by RSA Security Inc. Some of these standards handed over to standards organizations and they became industry standards after that.
Also, as @Maarten mentions, using CMS(PKCS7) format enables storing more than one certificate. (Check this answer)