I want to construct a PDF that has infinite variance.
So I started with the definition of variance $$ \operatorname{var}(X) = E[X^2] - E[X]^2 $$
I'll constraint the problem to a symmetric distribution about $x = 0$ to (hopefully) make this easier, so $E[X] = 0$. So I just need to worry about making $E[X^2] = \infty$.
$$ E[X^2] = \int_{-\infty}^{+\infty}x^2 f_X(x) dx $$
Is there an easy way to come up with a $f_X(x)$ so that $E[X^2]$ is infinity?
I am aware of distributions like Cauchy that have infinite variance, but here I want to come up with a custom one.
Restricted to $[0,\infty)$, you want $f(x)$ to be a function such that $\int_0^\infty f(x)\,dx$ converges but $\int_0^\infty x^2 f(x)\,dx$ diverges. (Really, you want $\int_0^\infty f(x)\,dx = \frac12$, but that can be fixed later by scaling.)
The Cauchy distribution is the go-to here because of the way power law integrals work: $\int_1^\infty x^p \,dx$ converges for $x<-1$ and diverges for $x \ge -1$. Of course, this behavior is flipped around for an integral near $0$, which is why the Cauchy distribution has $\frac1{x^2+1}$ in in it and not just $\frac1{x^2}$.
Another way to get the same effect is to take $f(x)$ proportional to $(|x|+1)^p$ for $p < -1$ (so that the integral of the PDF converges) but $p \ge -3$ (so that the integral of $x^2 f(x)$ diverges).
If you want variety, multiply by any function that grows sufficiently slowly: something involving logarithms, for instance. But remember that you'll need something you can integrate later, in order to scale the function so that $\int_{-\infty}^\infty f(x)\,dx =1$.