L
L
Legal Adviser2021-09-01 20:33:35
WordPress
Legal Adviser, 2021-09-01 20:33:35

How to implement the title of the post and in the form for communication in the title, taking into account the case?

Hello.
I decided to do it on the site in such a way as to facilitate the work for publishing articles, but a problem arose ... And so:
When writing a post or page, WP automatically suggests using Gutenberg to enter the main heading (h1).
I want to make sure that the page has two blocks in main - the first article, the second sidebar which should contain a feedback form with a subtitle ( <H2>).
For the first , of course, the title will look like (for example):
<h1>Оформление рисунка красками</h1>
For the second , there should be a subtitle based on the main title (because it should be a feedback form):

<h2>Консультация по оформлению рисунка красками</h2>

Those. it turns out that the heading itself is written in the nominative case, and in the feedback form “Consultation on” should be substituted and the heading should be added, taking into account the endings regarding declensions and in the prepositional case.
I was very confused)))
But, maybe someone will advise a simpler solution?
Maybe there is some option to make it so that when using the CF7 plugin, somehow implement the ability to independently specify a subtitle when compiling a post / page in WP (at the gutenberg stage) to display in one feedback form, which will be in the sidebar by default? Otherwise, there is no reason to rivet a feedback form under each post or page))
<main>
      <article>
        <h1>Оформление рисунка красками</h1>
        <p>абзац</p>
        <p>абзац</p>
      </article>
    <sidebar>
    <form>
      <h2>Консультация по оформлению рисунка красками</h2>
      <label>
         <input>
      </label>
    </form>
  </sidebar>
</main>

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Legal Adviser, 2021-09-06
@Legal2019

Decided to share my solution.
I was looking for various solutions to my question, but when I analyzed everything that I could find, the solution came by itself, so to speak, by accident.
I got three solutions:
1. Write a code in which to provide for the rule of the Russian language (cases, declensions, parsing by parts of speech, etc.)
Summary: long and far from easy .
2. Write code using (for wordpress):
- custom fields;
- shortcode;
- create a template.
Summary: not very long, but much easier compared to the previous option .
3. Using CF7 + ACF, write a couple of codes in the templates to display the shortcode.
Summary:fast, much easier compared to previous options .
Summarizing everything, I’ll say this:
Considering the fact that the ACF plugin automatically cuts off the standard settings for displaying arbitrary fields, and also due to the fact that I have CF7 + ACF plugins on my site, I decided to do exactly according to paragraph 3 as follows ( specifically for my template):
1. In the file where I have collected only shortcodes, but you can also drive them into function.php, I created a shortcode to display it in the right place on the sidebar.
2. In CF7, I created a contact form which is placed in the sidebar via a shortcode (see point 1).
3. In ACF, I created custom fields that are displayed in the taxonomy when a single entry is created and, by default, included specific text to automatically publish the form header. If there is a need to change the default text, I just change it and it changes for a specific entry in the contact form.
4. In the shortcode (see point 1) I included the key of the custom field created in ACF and the shortcode from CF7.
As a result:
On the required single taxonomy record through a pre-created template (for example: single-doc.php) two main blocks are displayed: article + sidebar. Accordingly, the article contains the main title (for example: <h1>дохлые мухи</h1>) and the article itself, and the sidebar contains the table of contents for the entire article and the form for linking to the title (for example: <h2>Узнать больше о дохлых мухах</h2>).
PS "Of course, for people who are professionally engaged in programming, this is no longer news, but for people like me (amateurs) this solution may be useful ;-)
" if it is not inside the article, but in the sidebar? (But I will ask this question separately)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question