Note (19 May 2022): The original proof of the theorem was a bit sloppy; I’ve cleaned it up and rewritten the proof of the corollary to make it a bit simpler.
The results in the comments are all negative. Here’s a positive result, albeit with a rather strong hypothesis:
Theorem: Every LOTS (space whose topology is generated by a linear order) has hereditary density equal to its density.
Proof: Let $\langle X,\le\rangle$ be a LOTS, and let $Y$ be a subspace of $X$. Let $D$ be a dense subset of $X$ of cardinality $d(X)$, and without loss of generality assume that $D$ contains the endpoint(s) of $X$, if any. For each $a,b\in D$ with $a<b$ and $(a,b)\cap Y\ne\varnothing$ fix $y(a,b)\in(a,b)\cap Y$. Let $I$ be the set of isolated points of $Y$, and let $$E=\{y(a,b):a,b\in D\text{ and }a<b\text{ and }(a,b)\cap Y\ne\varnothing\}\,.$$
Claim: $I\cup E$ is dense in $Y$.
Proof: Let $U$ be any non-empty open subset of $Y$. If $U\cap I\ne\varnothing$, we’re done, so assume that $U\cap I=\varnothing$. Fix $y\in U$; there are $a,b\in D$ such that $a<y<b$ and $(a,b)\cap Y\subseteq U$, and clearly this ensures that $y(a,b)\in U$. $\dashv$
Let $I_X$ be the set of isolated points of $X$, $X_L=\{x\in X:x\in\operatorname{cl}_X(\leftarrow,x)\}$, and $X_R=\{x\in X:x\in\operatorname{cl}_X(x,\to)\}$. Let
$$\begin{align*}
I_0&=I\cap I_X\,,\\
I_1&=I\cap(I_L\setminus I_R)\,,\text{ and}\\
I_2&=I\cap(I_R\setminus I_L)\,,\text{ and}\\
I_3&=I\cap I_L\cap I_R\,;\\
\end{align*}$$
clearly $I=I_0\cup I_1\cup I_2\cup I_3$.
Suppose that $y\in I_3$; then there are $a_y,b_y\in D$ such that $(a_y,b_y)\cap Y=\{y\}$, so $y=y(a_y,b_y)\in E$. Clearly $|E|\le d(X)$, so to show that $d(Y)\le d(X)$, it suffices to show that $|I_k|\le d(X)$ for $k\in\{0,1,2\}$.
For $I_0$ this is trivial: $I_0\subseteq I\subseteq D$, so $|I_0|\le d(X)$. Now suppose that $y\in I_1$. Then either $y$ has an immediate successor $y^+$ in $X$, or $y=\max_\le X$, and in either case there is an $a_y\in D$ such that $(a_y,y]$ is an open nbhd of $y$ in $X$ such that $(a_y,y]\cap Y=\{y\}$. It follows that if $y,y'\in I_1$, and $y<y'$, then $y\le a_{y'}$ and hence $(a_y,y]\cap(a_{y'},y']=\varnothing$. That is $\{(a_y,y]:y\in I_1\}$ is a family of pairwise disjoint open subsets of $X$, and since each must contain a member of $D$, we must have $|I_1|\le|D|=d(X)$. The argument that $|I_2|\le d(X)$ is entirely similar, and the theorem is proved. $\dashv$
Added: The result can be strengthened a bit. A GO-space is a Hausdorff space $\langle X,\tau\rangle$ with a linear order $\le$ such that every point of $X$ has a local base of $\le$-intervals; these intervals may be open, closed, or half-open, and if they’re closed, they may be degenerate. It’s well-known that $X$ is a GO-space iff $X$ is a subspace of a LOTS.
Corollary: If $X$ is a GO-space, then $d(X)=hd(X)$.
Proof: Let $\langle X,\tau\rangle$ be a GO-space with associated linear order $\le$, and let $D$ be a dense subset of $X$ of cardinality $d(X)$. Let $\tau_\le$ be the order topology on $X$ generated by $\le$; $\tau_\le\subseteq\tau$. Let $$L=\{x\in X:[x,\to)\in\tau\setminus\tau_\le\}$$ and $$R=\{x\in X:(\leftarrow,x]\in\tau\setminus\tau_\le\}\;.$$ Note that $L\cap R\subseteq D$.
Let $$X^+=\Big(X\times\{1\}\Big)\cup\Big(L\times\{0\}\Big)\cup\Big(R\times\{2\}\Big)\;,$$ let $\preceq$ be the lexicographic order on $X^+$ determined by $\le$ on $X$ and the usual order on $\{0,1,2\}$, and let $\tau_\preceq$ be the order topology on $X^+$ induced by $\preceq$. Let $X'=X\times\{1\}$; it’s a little tedious but not difficult to verify that the map $X\to X':x\mapsto\langle x,1\rangle$ is a homeomorphism of $X$ onto the subspace $X'$ of $\langle X^+,\tau_\preceq\rangle$. Let $D\,'=D\times\{1\}$.
Claim: $D\,'$ is dense in $X^+$.
Proof: Clearly $D\,'$ is dense in $X'$, so it suffices to show that $X'$ is dense in $X^+$. Suppose that $p=\langle u,k\rangle,q=\langle v,\ell\rangle\in X^+$, and $p\prec q$. If $u<x<v$, then $\langle x,1\rangle\in X'\cap(p,q)$, so suppose that $v$ is the immediate successor of $u$ in $X$. Then $u\notin R$, so $k\ne 2$, and $v\notin L$, so $\ell\ne 0$. If $k=0$, then $\langle u,1\rangle\in X'\cap(p,q)$, and if $\ell=2$, then $\langle v,1\rangle\in X'\cap(p,q)$. The only remaining possibility is that $k=1=\ell$, but in that case $(p,q)=\varnothing$, and there is nothing to prove. $\dashv$
Then since $X^+$ is a LOTS, we have
$$hd(X^+)=d(X^+)\le|D\,'|=|D|=d(X)\,.$$
But $X'$ is a subspace of $X^+$, so
$$d(X)=d(X')\le hd(X')\le hd(X^+)\le d(X)\,,$$
and hence $d(X)=hd(X)$, as desired. $\dashv$
Best Answer
Yes, this will hold. Details depend a bit on how you define the Heaviside function exactly. "Traditionally" locally constant functions with finitely many values are used, e.g. I myself usually replace $[0,1]$ in the exponent by the Cantor set (so we can have $f$ defined on finitely many clopen subsets). It's all a matter of taste, I think. The idea is the same.