Skip Navigation

[Resolved] How to insert something after Nth paragraph in custom text field

This support ticket is created 3 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 6 replies, has 2 voices.

Last updated by kirillS-3 3 years ago.

Assisted by: Minesh.

Author
Posts
#2235571

Tell us what you are trying to do?

I want to insert some content (picture or view or custom field from the post) after Nth paragraph of the text stored in custom field.

Is there any documentation that you are following?

There are a lot of ways how I could do it by plugins for the standard field "body", but I don't understand how to do it with custom text fields.

Is there a similar example that we can see?

e.g.

<p>...</p>
<p>...</p>
<custom content>
<p>...</p>
....

#2235775

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Toolset does not offer such feature that should use to count the number of P tags within the content and then add the required content. You will have to use custom jQuery/Javascript code your custom CSS to manage such requirement.

#2235913

I understand that Toolset doesn't offer this feature. My question was about how to use standard filters/3rd party plugins with custom fields as it used with post body or other standard fields. I believe it is something important about Toolset usage as if I want to show custom fields on my page I want to use other plugins to work with them.

#2235919

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Toolset offers place where you can add the custom CSS and Javascript.
=> https://toolset.com/course-lesson/adding-custom-javascript-to-views-templates-and-archives/

Its still not clear to me how exactly and what plugins you want to use. Basically Toolset works with all plugins. Toolset does not interfere other plugins output.

#2235999

Add custom CSS or JavaScript is not my goal.
I want to use MonsterInsight to add some popular post after 3rd paragraph or AdInserter to add some ads after 1st paragraph and before last paragraph. They both work automatically with body field. But the ignore other fields. So, the question is how to force other plugins to work with custom text field during output. Let's say - I want that I will output text field CustomText and process it with all plugins, which formats the output of post content.

#2236001

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

As shared there is no such feature available to count such paragraphs within the text field. This may require custom code which is beyond the scope of our support policy.

if you require custom code for your project, you are welcome to contact any of our certified partners:
=> https://toolset.com/contractors/

However, I'm not sure why you want to put such things within the text field as you can create a content template and design the content template and place the fields one by one and add whatever content you want but if your concern is to add something between the content of the custom text field then its not the thing you would like to hear but there is no such solution available other than the custom programming.

#2236159

You still pointing to the small part of the queston as about paragraphs styling coding. The issue is more about using standard polugins which styling/formatting output to output of custom fields. If I have some special big text fields I would like to use some plugins like ads plugin or opting plugins etc. to format output of these large text fields as it formatting body field.
There are exist one good exapmple - it is possible to show YoastSEO that it should use some fields to count SEO score. This is not exactly about formatting output, but the similar option for choosing fields with formatting output or special option in content template to formatting output of content template by installed plugins will be really great.