Following [this already answered thread](https://tex.stackexchange.com/questions/545664/no-page-break-between-a-command-and-the-following-paragraph), I have a related but different question for you.

**Problem :**

I frequently get page breaks right after my counter because of the presence of footnotes in it :
[![enter image description here](https://i.stack.imgur.com/kJ9qV.png)](https://i.stack.imgur.com/kJ9qV.png)

I know it is not recommended to use footnotes inside titles. However, I don't have the choice here. I also know that this feature exists with the usual `\section`, `\subsection` etc. But in this case, I cannot use these commands, I have to stick to my own command for two reasons :
- First, I have used them all and even created extra ones thanks to this community
- Second, the counter does not reset at all in the document.

**Partial solution :**

`titlesec` or `needspace` packages works well for titles without footnotes.

Would it be possible to stick the next paragraph to my counter with footnotes?
The document I am creating being quite long, it has to be automatic, i.e. I cannot manually add \pagebreak before lonely \numsubpara commands.

**MWE**

```latex
\documentclass[12pt,twoside]{book}
\usepackage[paperheight=240mm,paperwidth=160mm, left=22mm, right = 20mm, top = 20mm, bottom = 22mm]{geometry}

\usepackage[cam,width=17.5truecm,height=25.54truecm,center,dvips,noinfo]{crop}
\usepackage[french]{babel}

\usepackage{fontspec}
\usepackage{lipsum}
\usepackage{titlesec}

%\usepackage{needspace}
%\newcounter{subpara}
%\setcounter{subpara}{0}
%\newcommand\numsubpara[1]%
   %{\vspace{3.36mm}\par\refstepcounter{subpara}%
   %\needspace{2em}%
   %\fontsize{10}{12}\selectfont\textbf{\thesubpara.}\fontsize{12}{12}\selectfont%
   %\space\textbf{#1}\space\vspace{2.8mm}\\%
   %\fontsize{12}{12}\selectfont\nobreak%
%}

\newcounter{subpara}
\setcounter{subpara}{0}
\newcommand\numsubpara[1]%
   {\vspace{3.36mm}\par\refstepcounter{subpara}%
   \fontsize{10}{12}\selectfont\textbf{\thesubpara.}\fontsize{12}{12}\selectfont%
   \space\textbf{#1}\space\vspace{2.8mm}\\%
   \fontsize{12}{12}\selectfont\nobreak%
}

\newcommand{\nocontentsline}[3]{}
\newcommand{\tocless}[2]{\bgroup\let\addcontentsline=\nocontentsline#1{#2}\egroup}
\newcommand{\hnumsubpara}{\tocless\numsubpara}

\begin{document}

\chapter{Test}
\section{Test}
\hnumsubpara{Test}
\lipsum[1]

\hnumsubpara{My command\footnote{\lipsum[1]}}
\lipsum[1]

\tableofcontents

\end{document}

```

Thank you all in advance !