Example with 100 Bernoulli trials
The construction of confidence intervals could be placed in a plot of $\theta$ versus $\hat{\theta}$ like here:
Can we reject a null hypothesis with confidence intervals produced via sampling rather than the null hypothesis?
In my answer to that question I use the following graph:
Note that this image is a classic and an adaptation from The Use of Confidence or Fiducial Limits Illustrated in the Case of the Binomial C. J. Clopper and E. S. Pearson Biometrika Vol. 26, No. 4 (Dec., 1934), pp. 404-413
You could define a $\alpha$-% confidence region in two ways:
in vertical direction $L(\theta) < X < U(\theta)$ the probability for the data $X$, conditional on the parameter being truly $\theta$, to fall inside these bounds is $\alpha$ .
in horizontal direction $L(X) < \theta < U(X)$ the probability that an experiment will have the true parameter inside the confidence interval is $\alpha$%.
Correspondence between two directions
So the key-point is that there is a correspondence between the intervals $L(X),U(X)$ and the intervals $L(\theta),U(\theta)$. This is where the two methods come from.
When you want $L(X)$ and $U(X)$ to be as close as possible ("the shortest possible ($1−\alpha$) level confidence interval") then you are trying to make the area of the entire region as small as possible, and this is similar to getting $L(\theta)$ and $U(\theta)$ as close as possible. (more or less, there is no unique way to get the shortest possible interval, e.g. you can make the interval shorter for one type of observation $\hat\theta$ at the cost of another type of observation $\hat\theta$)
Example with $\boldsymbol{\hat\theta \sim \mathcal{N}(\mu=\theta, \sigma^2=1+\theta^2/3)}$
To illustrate the difference between the first and second method we adjust the example a bit such that we have a case where the two methods do differ.
Let the $\sigma$ not be constant but instead have some relation with $\mu= \theta$ $${\hat\theta \sim \mathcal{N}(\mu=\theta, \sigma^2=1+\theta^2/3)}$$
then the probability density function for $\hat \theta$, conditional on $\theta$ is $$f(\hat\theta, \theta ) = \frac{1}{\sqrt{2 \pi (1+\theta^2/3)}} exp \left[ \frac{-(\theta-\hat\theta)^2}{2(1+\theta^2/3)} \right] $$
Imagine this probability density function $f(\hat \theta , \theta)$ plotted as function of $\theta$ and $\hat \theta$.
Legend: The red line is the upper boundary for the confidence interval and the green line is the lower boundary for the confidence interval. The confidence interval is drawn for $\pm 1 \sigma$ (approximately 68.3%). The thick black lines are the pdf (2 times) and likelihood function that cross in the points $(\theta,\hat\theta)=(-3,-1)$ and $(\theta,\hat\theta)=(0,-1)$.
PDF In the direction from left to right (constant $\theta$) we have the pdf for the observation $\hat \theta$ given $\theta$. You see two of these projected (in the plane $\theta = 7$). Note that the $p$-values boundaries ($p<1-\alpha$ chosen to be the highest density region) are on the same height for a single pdf, but not for not at the same height for different pdf's (by height that means the value of $f(\hat\theta,\theta)$)
Likelihood function In the direction from top to bottom (constant $\hat \theta$) we have the likelihood function for $\theta$ given the observation $\hat\theta$. You see one of these projected on the right.
For this particular case, when you select the 68% mass with the highest density for constant $\theta$ then you do not get the same as selecting the 68% mass with the highest likelihood for constant $\hat \theta$.
For other percentages of the confidence interval you will have one or both of the boundaries at $\pm \infty$ and also the interval may consist of two disjoint pieces. So, that is obviously not where the highest density of the likelihood function is (method 2). This is a rather artificial example (although it is simple and nice how it results in these many details) but also for more common cases you get easily that the two methods do not coincide (see the example here where the confidence interval and the credible interval with a flat prior are compared for the rate parameter of a exponential distribution).
When are the two methods the same?
This horizontal vs vertical is giving the same result, when the boundaries $U$ and $L$, that bound the intervals in the plot $\theta$ vs $\hat \theta$ are iso-lines for $f(\hat \theta ; \theta)$. If boundaries are everywhere at the same height than in neither of the two directions you can make an improvement.
(contrasting with this: in the example with $\hat \theta \sim \mathcal{N}(\theta,1+\theta^2/3)$ the confidence interval boundaries will not be at the same value $f(\hat \theta, \theta)$ for different $\theta$, because the probability mass becomes more spread out, thus lower density, for larger $\vert \theta \vert$. This makes that $\theta_{low}$ and $\theta_{high}$ will not be at the same value $f(\hat \theta ; \theta)$, at least for some $\hat \theta$, This contradicts with method 2 that seeks to select the highest densities $f(\hat \theta ; \theta)$ for a given $\hat \theta$. In the image above I have tried to emphasize this by plotting the two pdf functions that relate to the confidence interval boundaries at the value $\hat \theta= -1$; you can see that they have different values of the pdf at these boundaries.)
Actually the second method doesn't seem entirely right (it is more a sort of variant of a likelihood interval or a credible interval than a confidence interval) and when you select $\alpha$% density in the horizontal direction (bounding $\alpha$ % of the mass of the likelihood function) then you may be dependent on the prior probabilities.
In the example with the normal distribution it is not a problem and the two methods align. For an illustration see also this answer of Christoph Hanck. There the boundaries are iso-lines. When you change the $\theta$ the function $f(\hat\theta,\theta)$ only makes a shift and does not change 'shape'.
Fiducial probability
The confidence interval, when the bounds are created in vertical direction, are independent of the prior probabilities. This is not the case with the 2nd method.
This difference between the first and the second method may be a good example of the subtle difference between fiducial/confidence distribution $\frac{d}{d\theta}F(\hat\theta,\theta)$ and the likelihood function $\frac{d}{d\hat\theta}F(\hat\theta,\theta)$ (where $F$ is the cumulative distribution function).