Skip to main content

Questions tagged [the-content]

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

133 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
3 votes
1 answer
779 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 ...
orionrush's user avatar
  • 910
1 vote
1 answer
31 views

Limit total tags in the_content

I am using the_content to display content in a custom theme, but I am running into an issue. Right now, I have some JS code that removes the <br> tags and replaces them with </p><p> ...
Josh Rodgers's user avatar
  • 1,173
1 vote
0 answers
46 views

Add Content Column to Custom Post Type backend

I have a basic custom post type: function create_posttype() { register_post_type('guestbook', array( 'labels' => array( 'name' => __('Guestbook Entries'), ...
Josh Rodgers's user avatar
  • 1,173
1 vote
2 answers
189 views

Adding to the_content or a variable from within a shortcode function

I've created a custom shortcode to add pop-up definitions to selected vocabulary terms. The shortcode looks like this: [glossary term="data breach"]data breaches[/glossary] The function ...
BoyKenan's user avatar
1 vote
0 answers
48 views

show content of a page built using yootheme builder on different page/template

I have a WordPress page built using Yootheme builder. I want to show the content of that page on woocommerce Category page. namespace YOOtheme; global $post; $post = get_post(2434); setup_postdata( $...
Div's user avatar
  • 11
1 vote
0 answers
160 views

Filter on the_content doesn't update the content being searched via register_rest_route

I'm trying to get my custom REST route to include search results from a filtered the_content. I'm trying to automatically include the post tag names within each post's content, so that searching can ...
David Merritt's user avatar
1 vote
1 answer
880 views

Styling text and images in the_content()

So I have recently started working on Wordpress and coming from a different programming background, having the logic but not being able to actually code is an issue I have been butting my head on for ...
Anuj Kaithwas's user avatar
1 vote
0 answers
138 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 ...
gxrobb's user avatar
  • 19
1 vote
0 answers
28 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??
trip1e's user avatar
  • 21
1 vote
0 answers
716 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'...
Oneezy's user avatar
  • 111
1 vote
0 answers
332 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 ...
user9664977's user avatar
1 vote
0 answers
21 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 ...
De Coder's user avatar
  • 329
1 vote
1 answer
157 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 ...
Kevin Nugent's user avatar
1 vote
0 answers
321 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. ...
Edwin Raynor's user avatar
1 vote
0 answers
51 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. ...
Galgóczi Levente's user avatar
1 vote
1 answer
137 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 ...
JasCav's user avatar
  • 137
1 vote
2 answers
184 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 ...
Downloadtaky's user avatar
1 vote
2 answers
2k 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
mr_ed's user avatar
  • 11
1 vote
1 answer
243 views

Caching the_content calls

I am writing a very small cache plugin called Tiny Cache. It would cache only the_content() calls which take - I think - the longest time to generate during a page load. I am able to hook the_content ...
Szépe Viktor's user avatar
1 vote
0 answers
328 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 ...
Sebastian's user avatar
  • 111
1 vote
1 answer
351 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 ...
tommyf's user avatar
  • 405
1 vote
0 answers
126 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 . ...
Locke's user avatar
  • 185
1 vote
0 answers
534 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 ...
theyuv's user avatar
  • 209
1 vote
0 answers
199 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 ...
b3asts's user avatar
  • 11
1 vote
0 answers
305 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) ...
RichyVN's user avatar
  • 46
1 vote
1 answer
196 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 ...
Clinton1000's user avatar
1 vote
0 answers
98 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 ...
Matt Adams's user avatar
1 vote
1 answer
729 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 ...
Brad Dalton's user avatar
  • 6,936
1 vote
0 answers
1k 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 ...
Ali Almoullim's user avatar
1 vote
0 answers
269 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 ...
Mark.C's user avatar
  • 73
1 vote
0 answers
71 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></...
Yoav Kadosh's user avatar
1 vote
0 answers
436 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 ...
bestprogrammerintheworld's user avatar
1 vote
1 answer
1k 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('...
José Luis Quintero's user avatar
1 vote
1 answer
163 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 ...
Marcel's user avatar
  • 15
1 vote
1 answer
103 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 ...
Richard's user avatar
  • 173
1 vote
1 answer
320 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 ...
Mcestone's user avatar
  • 111
0 votes
0 answers
18 views

modify the_content() for page to display attachments with own style

I have for display attachmet on page this function $attachments = get_posts( array( 'post_type' => 'attachment', 'posts_per_page' => -1, ...
mardon's user avatar
  • 121
0 votes
0 answers
25 views

Why does the_content filter output var_dump, print_r or echo surrounded by quotes?

I'd like to alter the images for a particular page using the_content filter. When debugging or testing elements of the code, I've noticed that the output is surrounded by quotes. For example, print_r( ...
Motivated's user avatar
  • 215
0 votes
1 answer
21 views

Wp private content show me files attachments into post

I'm using that plugin wp private content and it works fine, but (probably for a update) that show me at the final part of the post a box with link to download someting...in each post! Even if the post ...
Marcos's user avatar
  • 187
0 votes
0 answers
22 views

WP: Override/update the_content from database with the publicly echo the_content

I have many hooks that apply to the_content (post content) so I want to override the database with that final version of the_content (the one that loads publicly to the user), so I get rid of all the ...
david-2021-learning's user avatar
0 votes
0 answers
28 views

Nested ShortCode works inside the_content, but not outside of it

community; I've spent all weekend trying to crack a problem that so far eludes me. On a multisite implementation, I'm using a simple homegrown plugin to include textbits that are the same across ...
eLeXeM's user avatar
  • 3
0 votes
0 answers
181 views

Using str_replace on the_content and the_excerpt, but not working on archive index pages

I am using code like this to replace a string in my posts. function replace_text($text) { $text = str_replace('look-for-this-string', 'replace-with-this-string', $text); $text = str_replace('look-for-...
McFarnell's user avatar
0 votes
1 answer
34 views

Add hook after content without formatting

I want to add a table after the_content with a hook, but it's adding <p> tags in certain areas. This is a plugin, I don't want to remove <p> tags from all the_content, just the table I'm ...
Justin Breen's user avatar
0 votes
1 answer
844 views

How do I display main query posts in random order using add_filter

So I tried two methods to simply display the main query posts in random order - simple. I'm also trying to understand all this better. Using the_content add_filter, with my own instance of WP_Query ...
Mario's user avatar
  • 1
0 votes
1 answer
115 views

How to Create custom block for displaying information in content section which act like shortcode

I wanted to Display one block which act like shortcode in front and plugin in background. For Example <div class="one-fourth fl glousp-box"> <p class="figure">5000+</...
Bhargav Joshi's user avatar
0 votes
0 answers
109 views

Give ID to divs inside the loop

I'm trying to make this code work on my WordPress site: https://codepen.io/eksch/pen/xwdOeK It is a simple code so that each menu item receives the active class when the user scrolls through the page, ...
Eduardo Reis's user avatar
0 votes
1 answer
497 views

How to remove image size inline style in article and include caption

I am using the following filter to remove the inline style in the image tag when used in the content editor of the ACF text field: add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); ...
Andrew's user avatar
  • 1
0 votes
1 answer
186 views

the_content getting current page content instead specified ID

I'm using below code to call the_content of a custom post type post, but when I'm run it, it always getting the current page content not the page whose ID specified. It literally duplicate my page ...
Ajay Malik's user avatar
0 votes
0 answers
562 views

Is there a way to get rendered html content of a WP post after updating?

I tried adding a filter at the content etc but that one just gives access to content stored in wp_posts. I am interested in getting the rendered html with meta tags etc for a post, after it is updated....
chatnoir's user avatar
0 votes
0 answers
325 views

get_post() with filters applied

*** PLEASE SEE UPDATE BELOW AS THIS QUESTION IS EVOLVING *** Is it possible to call get_post() and have the filters applied for the ID passed to the get_post() function? My client has asked if we can ...
Mark19's user avatar
  • 1