Questions tagged [the-content]

Displays the contents of the current post. This template tag must be used within The_Loop.

117 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
2
votes
1answer
381 views

Proper use of the_content filtering

This is a bit difficult without posting scads of code, but my question is: What are the benefits of filtering through apply_filters('the_content', 'anything');, and given my example loop, am I ...
1
vote
0answers
21 views

Force Balance Tags not working

I am trying to shorten my the_content() word count to 200 while retaining the html formatting as well as the shortcodes. I am pretty close but for some reason, I cannot get force balance tags or ...
1
vote
0answers
22 views

How can I add class to every quote element?

How can I edit defualt class of quote element? Can I use some kind of hook in the_content to add class to any other element??
1
vote
0answers
87 views

Removing “wpautop” (auto <p> tags) only on certain pages?

I'm using the remove_filter in functions.php to remove the auto insertion of <p> and <br> tags on my wordpress site. remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt'...
1
vote
0answers
226 views

Gutenberg is Adding Additional HTML Tags When Grabbing the Excerpt

I am running into an issue with Gutenberg where I want to display the excerpt of a post, even when the excerpt field isn't filled in. Usually the functionality of WordPress is when the excerpt is ...
1
vote
0answers
17 views

Missing content in Pages only

I have an odd one. One site is missing all content on it's page (but not posts.) If I add a filter on 'the_content', $content is empty. I've tried giving the filter priority of 1, 0 and even ...
1
vote
1answer
71 views

Differentiate Nested WP_Query from Parent

I'm filtering the_content in order to append a grid of related posts onto a single post with a nested WP_Query and would like to use the same content.php file as I do for my main query. The problem is ...
1
vote
0answers
316 views

Show the content that is after the excerpt using child theme

How do I set a value for $stripteaser using the functions.php file in a child theme so that when the_content() is called on post pages only the post exerpt is shown? I have a theme that I am using. ...
1
vote
0answers
41 views

get post id by $content (so by post content)

So weird, huh? But, not joke --> I try to be very clean of being: I have a subdomain based multisite network. If the users posts to their sites, I get a clone from the current post to my network home. ...
1
vote
1answer
59 views

Content vs Template on custom post

I just wrote a custom post (suppliers) as a plugin (with meta content) that works great. I've also created a template page (single-suppliers.php) within the same plugin to display the data. I wrote it ...
1
vote
2answers
84 views

Add content as soon <body> starts

So, what I am trying to do is creating a slideshow plugin that won't require end user to write a single line of code. I can't use custom posts because I need to keep it simple for the end user. Is ...
1
vote
2answers
995 views

Remove Content Filter

I need help with removing the Content Filter from a Plugin: add_filter( 'the_content', array( &$this, 'addContentAds' ), 8 ); Do someone could help me please? Thank you and best regards
1
vote
1answer
555 views

Extremely slow pageload for long post when using the_content?

My WordPress site has quite a few long posts that slow down page loading time exponentially. This only happens when using the post_content, for example, when using the the_content() and ...
1
vote
0answers
307 views

Run Shortcode of post's custom field in functions.php / Plugin

After 3 or 4 hours of searching the web for a solution, I abandoned it and hopefully you can help me? I added a sub-headline as a custom field (subheadlineclass). That works pretty. I can save, edit ...
1
vote
2answers
998 views

has_shortcode for content added after the content

I added some shortcode after the content using filter, like this: add_filter( 'the_content', 'image_posts' ); but now that I run has_shortcode in another function, this returns false even though the ...
1
vote
1answer
294 views

Output content to the_content before a plugin does

I'm using a plugin that appends to the_content() at a priority of 100. I want to place some content after the main content but before this plugin outputs. I assumed if I use a priority less than 100 ...
1
vote
0answers
119 views

Hide Gallery from the_conent

I'm using a function to separate Featured Content. What I mean is that: if I selected format Gallery will show the First Gallery in my post , if I choose format Video , will show a video instead . ...
1
vote
0answers
338 views

Add Attribute to p Tag of Post Content

I would like the default <p> elements that are added to the (TinyMCE) editor when users post content, to have a dir attribute as well. Reasoning: When the editor is displayed to users, it is ...
1
vote
0answers
185 views

the_content filter on some post types only not working

I'm using a filter on the_content to insert an ad after the first paragraph of a post and it is working fine. But I'm also using a plugin called Live Blogging Plus and it uses a post type called ...
1
vote
0answers
206 views

Adding the_content() in custom template email

Let my explain the scenario first: I have a very custom page template. That is use in combination with a CPT and a few Custom fields. The CPT is called "werklijsten" (it's in dutch so bare with me) ...
1
vote
1answer
126 views

Changing Image Size In The Content tag

I am developing a WordPress theme locally and I can't figure out how to get an image to display in a normal size in the_content(). At the moment, the images are displaying the same size as my featured ...
1
vote
0answers
87 views

Mirror content based on URL slug

I have a training site that manages the same content across several branded versions. examples: .com/product-name-a .com/re-brand1/product-name-a .com/re-brand2/product-name-a Where all 3 are the ...
1
vote
1answer
642 views

Execute Closing Shortcode After the_content

I need to execute a short code on thousands of posts which don't already contain the short code as i've added some manually. I'm using another function to add the opening short code after the 2nd ...
1
vote
0answers
741 views

the_content() - Getting formatted text

I'm using the_content() to display the content of a post in my theme, but unfortunately im getting plain text (with link and pics of course but the other are just plain text). I want to get formatted ...
1
vote
0answers
262 views

More efficient to add content to custom fields or the content area?

I often build themes that handle a lot of text content. I use Advanced Custom Fields to create several custom field areas per page for adding this content. I've also used themes with page builders ...
1
vote
0answers
65 views

<p> tag removed not using a filter

Very strange WordPress behavior: <p> tags are removed when placed inside <pre> tags, but not always. for example, this works fine: <pre><p>This is a paragraph</p></...
1
vote
0answers
215 views

Is it better to use filter for the_content in archive pages?

I'm using advancd-custom-fields plugin and I'm about to modifiy my acrhive content page that is shown frontend. I use the file personnel-archive.php (because the custom post type used is personnel) in ...
1
vote
1answer
829 views

Can I insert the feature image inside the content, after any paragraph?

I want to display the feature image inside a post text, perhaps after the third or fourth paragraph (or any) into the_content. Searching the site I've found this code, by Amit: add_filter('...
1
vote
2answers
68 views

Adding a form at the end of the content

I'm trying to add a little form after each post for a plugin I have to code, but I'm not very familiar with Wordpress. By using add_action with the_content as hook, I was able to add some text to the ...
1
vote
1answer
154 views

Single post content custom order

In my post I have a shortcode for [video] than text content. Single post page displays first entry-meta, than title, than content [video] + text. What I need is to add some condition in single.php so ...
1
vote
1answer
40 views

Custom Blocks as part of a theme

I'm new to wordpress, but I'm a pretty competent developer. I'm trying to nail down what my client can do to their site. My idea was to create some special 'blocks' for them, which provide the page ...
1
vote
1answer
230 views

Custom image size in the_content loop

I changed the default image dimensions for the "large" thumbnail and re-generated my images using a plugin. The new image size is only shown on new posts created after the image size was created. How ...
0
votes
0answers
12 views

Best way to add ACF fields to post_content

I have a post type and the content of every post is entirely from custom fields. Image fields, various text/wysiwyg fields, and others. There are certain plugins I want to take advantage of that rely ...
0
votes
0answers
9 views

One post per one column item in a row. How to?

I am planing to construct a new responsive website from sratch. Initial plan is at least one row with three columns for index.php (within body tag). What approach would be better to achieve my goal so ...
0
votes
0answers
34 views

How do I output ACF custom fields within the_content() AND strip tags?

I'm trying to output a text-only version of the_content, that includes all custom blocks. echo wp_strip_all_tags( get_the_content() ); strips tags and outputs text only, but only for native content. ...
0
votes
1answer
21 views

the_content() not showing the content in good order (with a shortcode)

I've added a shortcode [form] inside my wysiwyg the 2 paragraphes before the shortcode. <p>test 1</p> <p>test2</p> [form] but on the frontend, the shortcode is showing at ...
0
votes
0answers
8 views

How do I isolate and customise the content of Wordpress blog posts (such as images and texts blocks)?

I am currently developing my own theme in Wordpress for my blog and aim to customize as much as possible, only really using Wordpress for its CMS. I have drafted out the basics of a Wordpress theme ...
0
votes
0answers
10 views

Hook for after content field, not the_content

Is there a hook to insert code after the standard content field? Not 'the_content' hook, which encompasses the entire content, including all the custom fields. Just the content field text, I would ...
0
votes
0answers
22 views

how can i take wordpress post as embed?

how can i get an adress for using iframe in another website? Example: site.com/sample-page i will use this page in another website as iframe but only content part Example: <iframe src="site....
0
votes
1answer
35 views

Get featured image from post on RSS feed

I want to add the featured image to my RSS feed. function rss_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<p>' . ...
0
votes
0answers
155 views

Auto generate excerpt from ACF field on a CPT that does not support excerpt or content

I have a CPT which contains only 4 wysiwyg fields created with ACF. The CPT does not support standard WP excerpt or content fields. I would like the CPT to generate an excerpt automatically from one ...
0
votes
0answers
37 views

Remove pre and code tags from WordPress

WordPress has added both <pre> and <code> tags to my PHP embedded in a post. Here's an example <pre><code>register_taxonomy( 'Books', 'post', array( 'label' =&gt; __(...
0
votes
0answers
12 views

Post content is escaped when visual editor is turned off

When visual editor is turned off, then $post->post_content is escaped. With visual editor turned on, the exact post content is obtained as saved. When visual editor is ON, output of $post->...
0
votes
0answers
10 views

My edits are not saved

Everything used to be fine, but now for some reason I’m editing the record, but the old content remains, the new one for some reason does not appear. For example, I have everything stored in the pages ...
0
votes
0answers
30 views

How to wrap pattern-matches from the_content in [wiki]-shortcode tags

I'm working on a function to wrap word-matches* in [wiki]-shortcode tags. I suspect the best method is to use add_filter() on the_content, and parse using RegEx in preg_replace_callback_array(), but ...
0
votes
0answers
40 views

Cannot replace header & footer using “the_content”

It replace everything except header & footer. I've tried different priority for this function but it doesn't seem to work. I think the_content is only for content and not header/footer, but after ...
0
votes
1answer
119 views

Replace an array (with identical values) with another array in the_content

I'm making a plugin where I need to edit the H2 tags in the post content. I've been at it for two days, but my php knowledge is too limited to solve the issue.. What I want to achieve is to return ...
0
votes
0answers
17 views

How to wrap ALMOST all content in a div for all old content?

Nearly all of my posts have normal content but then ends with a shortcode. So, h2 elements and paragraphs, but then at the end of the post, the shortcode that ends up implementing a div tag with ...
0
votes
0answers
24 views

Wordpress the_content Filter and GET Parameter

i have the following Problem and i have no ideas left. I try to explain: We have some Producttests you need to register for. A Post can be a Producttest, wich is indicated by a checkbox in the ...
0
votes
1answer
91 views

Strip all HTML tags from product content and resave

My client has loaded about 500 products into Woocommerce, but has inadvertently pasted in a stack of extra tags into the product description- divs and spans etc like below: <div class="summary ...