Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [the-content]

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

2
votes
1answer
244 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 ...
2
votes
1answer
306 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
1answer
47 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
1answer
45 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
1answer
87 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
1answer
604 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
1answer
221 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 ...
1
vote
1answer
699 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
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 ...
0
votes
1answer
13 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 ...
0
votes
1answer
20 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 ...
0
votes
1answer
18 views

Add HTML before a specific div?

I bought the "Woocommere Checkout Add-Ons" Plugin, which adds upsells to the checkout page - but it only allows to place text after the upsell checkbox. So I got the idea to add an image with some ...
0
votes
1answer
18 views

Set Microsoft Word links to open in new window/tab

I'm unable to set Word hyperlinks to open in a new window/tab. Basically, I create a Word document and paste its contents to WordPress, and everything is there, links do work, but they don't have "...
0
votes
1answer
150 views

Split the_content into two parts

I want to split the content of a post into two parts. The First part is in an <strong>-tag, it is like a excerpt and in the second part i want to display the rest of the content. But I don‘t ...
0
votes
1answer
19 views

How do I isolate the reason a wordpress filter is not running?

I have a wordpress filter defined in my theme's single.php: header( 'X-Filter-1: here' ); add_filter( 'the_content', function( $content ) use ( $details ) { header( 'X-Filter-2: here' ); /...
0
votes
1answer
764 views

Remove External Links from WordPress posts Using add_filter() in Theme functions.php

We have been searching high an low for a plugin, code sample or example of how to remove all external links at the theme filter level but can't seem to find anything online. We want to keep the ...
1
vote
0answers
127 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
16 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
0answers
295 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
30 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
0answers
281 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
0answers
118 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
253 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
162 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
188 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
0answers
85 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
0answers
580 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
261 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
64 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
197 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 ...
0
votes
0answers
27 views

Filter to APPEND nofollow to rel

I am trying append nofollow to add external links. If a link does not have a rel attribute, rel="nofollow" will be added. If a link already has rel="nofollow" nothing will happen, and if a link has ...
0
votes
0answers
8 views

Apply a different filer and parse the entire document instead of just the_content

Good morning, I'm trying to modify a plugin, to lazy load my images (a3 lazy load). The problem is that this plugin is returning only the images in the content, but for some reason when we created ...
0
votes
0answers
27 views

How to parse any content which was added after the working out filter 'the_content'

How to parse any content which was added after the working out filter 'the_content'? For example I have html structure of the simple page that i was created via Worpdress Admin Dashboard -> Pages -> ...
0
votes
0answers
49 views

Get post content before rendering

I am currently working on a shortcode function, where I need to access the content of a post, before its rendering. If I do it like this $content = get_the_content( get_the_ID() ); It gives me the ...
0
votes
0answers
20 views

Adding HTML every number of words in the content

I'm building a news website and i want to add a banner every 200 words inside the content. How can i add a plain html inside every article when calling the content function?
0
votes
0answers
18 views

the_content() breaks html while generating exceprt up to “more” tag

So I have a post with img src in it, after which goes the "more" tag. Something like this: text <img src= http://images.com/images/image.jpg> text <!--more--> more text Notice the space ...
0
votes
0answers
13 views

Title and date of last post stays on page even after replacing the_content

I'm doing a plugin that generates custom subpages (i.e. it's an app that has nothing to do with WPs posts). I did the rewrite thing (rewrite + query_vars + template_redirect), I generate the content ...
0
votes
0answers
26 views

One Content Filter To Rule Them All

I have a plugin that fetches post content, then runs it through a series of custom and native the_content filters and updates the post using ajax. Problem is that I have many other filters also ...
0
votes
0answers
32 views

Specifying image size used in template the_content

I have a template that is used to display all posts. It uses query_posts with a set of $args that I specify. The template uses the_content to output the content of each post (text and images) I want ...
0
votes
0answers
108 views

the_content filter not working when Jetpack activated. Any idea?

I use this function to filter some posts content: function frontend_wizard_content($content){ if ( !is_page(213) ) return $content; ob_start(); locate_template('mycontent.php', true); ...
0
votes
0answers
95 views

Can I add content before post content without using the_content filter

I am adding filter to add embed before post content, but don't want add to other places where called apply_filters("the_content"). So i need add embed before(after) post content without "the_content" ...
0
votes
0answers
38 views

if CPT content is empty then

I need to be able to do something if the content is empty in a CPT. This works for standard WP posts using the following: if($post->post_content=="") { //Do something if there is content is empty ...
0
votes
0answers
237 views

Why is every single HTML tag being stripped out of liveblog entries?

I have variously been using Livepress and the Automattic/Wordpress VIP Liveblog plugin as a live-blogging solution. However, I have run into an issue that does not seem specific to either plugin but ...
0
votes
0answers
147 views

How Can the_post Be Hooked Like the_content and the_excerpt?

My plugin currently hooks properly with the_content and the_excerpt, but when I try to hook the_post, I get the error "Catchable fatal error: Object of class WP_Post could not be converted to string......
0
votes
0answers
129 views

Filter the_content() to add custom figure tags

I'm trying to implement responsive images on my site, and have all the required component parts working, and understand the concepts, but need some help putting them together; Knowing that WordPress ...
0
votes
0answers
51 views

Search & Replace trailing strings

I need to filter the_content/the_excerpt and search & replace the following prepared array: $searchArray = array("foo", "bar", "foo bar", ...); My problem is the fact, that using php's ...
0
votes
0answers
232 views

Add class to all parent elements inside the_content

Is there a way to add a class to all parent elements inside the_content? My problem is I'm using this kind of css selector: .post_content>* {margin-bottom:10px;} This is to due with mostly ...
0
votes
0answers
489 views

Removing image dimensions from `the_content`

I'm looking to remove image dimensions from the_post_thumbnail, as well as the_content. I've found the following code, but there's a slight issue: add_filter( 'post_thumbnail_html', '...
0
votes
0answers
117 views

Suppress the_content filter in a nested loop

I have some layout changes that are being applied to the_content. I need to do one of two things, but neither is working as expected... either: Pass data to the filter so that it knows if it is a "...
-1
votes
0answers
204 views

Need to access HTML from the_content()

A page template I have calls the_content(), which generates html utilizing Bootstrap with a 2 column grid. Main column and sidebar. I have found the file that generates the main column content but I ...