For $G$ a topological group denote $G^\circ$ its unit component.
Say that a topological group $K$ is compact-semisimple if it is compact, connected and has a dense commutator subgroup. It actually follows that $K$ is a perfect group (abstractly), and that $K$ is quotient of a (possibly infinite) product of simple compact Lie groups by a central subgroup. Moreover, for every compact connected group $K$, the commutator subgroup $[K,K]$ is closed and compact-semisimple, and moreover $K=[K,K]Z(K)$, $Z(K)$ being its center. In addition, if $K$ is compact-semisimple, then $\mathrm{Aut}(K)^\circ$ consists of inner automorphisms.
Lemma: let $K$ be a compact group with $K^\circ$ abelian. Then $\mathrm{Aut}(K)$ is totally disconnected. (The topology being the compact-open, hence, in the compact case, the topology of uniform convergence.)
Proof: if $K$ is profinite this is clear. If $K$ is abelian, then its Pontryagin dual being discrete, this is clear again. Hence, in general, $\mathrm{Aut}(K)^\circ$ acts trivially on both $K^\circ$ and $K/K^\circ$, hence each $\beta\in\mathrm{Aut}(K)^\circ$ acts as $g\mapsto gu_\beta(g)$, with $u_\beta$ some homomorphism $K\to K^\circ$ trivial on $K^\circ$; $\beta\mapsto u_\beta$ is continuous. If $L$ is the Hausdorff abelianization of $K/K^\circ$, then $\mathrm{Hom}(K/K^\circ,K^\circ)=\mathrm{Hom}(L,K^\circ)$. Again by Pontryagin duality, $\mathrm{Hom}(L,K^\circ)$ is totally disconnected. Hence by connectedness $\beta\mapsto u_\beta$ is the constant $0$. So $\mathrm{Aut}(K)^\circ=\{\mathrm{id}\}$. $\Box$
For $G$ connected locally compact group, let $W$ be a compact normal subgroup (there's a maximal one). Write $S_W=S_W(G)=[W^\circ,W^\circ]$, and let $H_W$ be its centralizer, and $W'=W\cap H_W$. Hence we can apply the lemma to $W/S_W$, and thus by connectedness of $G$, we deduce that $W/S_W$ is central in $G$. Since $S_{W'}(H)=1$), we have $W'=W\cap H_W$ central in $H_W$.
Also, since $S_W$ is compact-semisimple, by connectedness of $G$, the conjugation action is by inner automorphisms, which implies that $G=S_WH_W$. The intersection $S_WH_W$ is a central profinite subgroup of $G$.
Hence a recipe to produce all connected locally compact groups is: consider a compact-semisimple group (as above, produced as a product modulo some central subgroup), consider a connected locally compact group that is central-by-Lie, and mod out by a diagonal central profinite subgroup intersecting trivially each of the two direct factors.
Essentially, this reduces everything to an understanding of central extensions by compact kernels.