The Stack Overflow podcast is back! Listen to an interview with our new CEO.

Questions tagged [the-content]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
6 views

Unclosed tags of Shortcode attribute results in plain text

I have several shortcodes and I have recently noticed, due to an error while copying, that if the attribute looks like this: [QUANTITY number="01" title="test<"] with the < tag, without ...
-2
votes
0answers
21 views

the_excerpt() & the_content() are running outside of their div container

I'm really struggling with a problem I've got on my custom wordpress theme. See the photos below. In both cases when I've called the_excerpt() & the_content() the displayed text is running out ...
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
1answer
19 views

How to bind each “the_content” elements to a custom variables

I'm implementing bootstrap theme into wordpress and i need you'r help. In Wordpress i created a simple page with paragraph and a list of 3 item's. Product list one Product one - Link Product two - ...
0
votes
1answer
26 views

How to use embed_content hook?

From the document of embed_content: Prints additional content after the embed excerpt. But I don't know which content it will print. Does it take any arguments?
0
votes
1answer
10 views

auto link word link in content

i use this code for auto link word in content <?php function link_words($content){ $words=array( 'test1', 'test2', 'test3' ); $links=array( '<a href="/tag/test1/" rel="nofollow"&...
0
votes
1answer
14 views

How to hook code to show after the_content?

I am trying to hook some content AFTER the_content, but no matter how I do it I still get my custom content BEFORE the_content: add_filter( 'the_content', 'ow_add_sctns_to_ctnt' ); function ...
0
votes
1answer
51 views

the_content() printing DOCTYPE, <html> and <body> tags in the middle of page

I'm building a custom Wordpress theme and I've just come across a bizarre issue where the_content() seems to be printing out the page content wrapped in the following: <!DOCTYPE html PUBLIC "-//...
0
votes
1answer
18 views

How to remove a specific word at the beginning of the content and add it to the end of the content

I want to remove any words in the text of posts, before a specific letter (such as :) that comes at the beginning of the text and add that word to the end of the text. for example: » Original text ...
0
votes
1answer
21 views

Shortcode conflicts

My plugin provide shortcodes like this: [cfgeo return="city"] - returns city name [cfgeo include="us"]Text only seen in the US country[/cfgeo] - returns this text only from the visitors in the US. ...
0
votes
0answers
23 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
2answers
49 views

Filter Gutenberg Blocks Content

I have a simple terms page made up of heading and paragraph blocks. I'd like to filter the_content before output in order to get the content of any heading blocks and create a menu with links to named ...
0
votes
0answers
34 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
29 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
16 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
20 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
26 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
0answers
32 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
9 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 ...
1
vote
2answers
76 views

Wrap h1-h6 in a div

So, I am using heading tags h1-h6 on my site in various places, what I'd like to do is put a div around those tags using a WP function. Right now I am using some jQuery to get the job done, but I'm ...
0
votes
2answers
60 views

Add HTML code before the title of the Tag page

I want to show an iframe at the top of a specific Tag page, so once I have is_tag('my_tag'), I will add the iframe before the title of the page. I've tried this code to show the iframe before the ...
0
votes
1answer
36 views

How to echo a PHP Code After the Content

i wanted to execute a code after the Content of each blog post. I just want it to be on posts and not on pages. I could execute simple html by the method but could not put the following content. ...
1
vote
1answer
35 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
2answers
43 views

Adding HTML to the end of every post with the Block Editor

I'm converting my posts over to use the new Block Editor. In the past I added an icon to the end of every post to act as a signature and marker saying the article is over (like print magazines do). I ...
1
vote
1answer
18 views

How to hide Ads in between posts on AMP? [closed]

I am using the following code to show ads on my posts after Para 4:- add_filter( 'the_content', 'prefix_insert_post_ads' ); function prefix_insert_post_ads( $content ) { $ad_code = My Ad code; ...
1
vote
1answer
63 views

How to call function at the bottom of post using plugin?

I am creating a plugin and need to write a function which will invoke at the bottom of posts. Currently, I have a shortcode created and I'm calling the shortcode at bottom of each post wherever ...
0
votes
0answers
46 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 -> ...
2
votes
1answer
34 views

the_content() in single-{post-type}.php problem

I have Custom Post Type "pjesma" (song), and the only way I managed to display the content is like archive-pjesma.php. It works fine: <?php get_header(); global $post; $args = array( 'post_type' =...
0
votes
1answer
22 views

get_post() containing gallery is outputting an unmatched closing div at the end of the content

I have created a custom page with fetches content from various posts using get_post(id). I fetch the posts using this function:- function get_my_post($id){ $get_post = get_post($id); $...
0
votes
1answer
248 views

the_content(); of custom post type treated as an array or object

I created a custom post type in the mu-plugins folder. function wpdocs_codex_book_init() { $labels = array( 'name' => _x( 'Books', 'Post type general name', '...
0
votes
1answer
19 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
119 views

WordPress adding content into different sections

What I'm trying to figure out is how I can get the content of a page displayed different div's. That means if I add two paragraphs in the editor I would like to display the first paragraph in div ...
1
vote
2answers
22 views

Inserting a functions output after the content

So I am trying to add a button at the end of my blog posts, here is the code I have in the plugin so far: <?php /* Plugin Name: etc.... */ function shares_content() { ?> <div class='...
1
vote
1answer
89 views

Responsive class to all the images in the content

I have used this function to add a responsive class to all the images in content but this breaks the html structure of the website. This wraps the content with : <!DOCTYPE html PUBLIC "-//W3C//DTD ...
0
votes
1answer
21 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 "...
1
vote
1answer
180 views

How to count rows of table in the_content()

In fact, every post in custom post type contains just a table that has several different rows. Every row is important, so we want to count them by a function and I think it is possible by counting <...
1
vote
0answers
165 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 ...
0
votes
0answers
137 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
1answer
286 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
2answers
35 views

How to replace text in hompage only

I have a wordpress site with the 10 latest posts shown on the homepage. I need to modify some text (because of duplicate content) on homepage but not on post page. I try to modify the following line ...
-2
votes
1answer
26 views

Creating mixture of shortcodes to use in the visual/text editor

I am attempting to make a page on my site that has a mixture of different kinds of content. So I'd like for the first part to just be the_content, but then beneath it calls to posts under specific ...
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 ...
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 ...
0
votes
0answers
28 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
36 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
2answers
985 views

get the_content by ID and save the result to one array

I try this: <?php function get_ct($id){ $ct = apply_filters('the_content', get_post_field('post_content', $id)); return $ct; } $arr = array('post_content' => get_ct(...
1
vote
1answer
58 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
853 views

How to change the order (priority) of registered filters (or actions) (e.g. for the_content)?

Is there any way to change the order of filters for e.g. the_content before they are applied? What I currently have is the following ideas: /** * Print all filters for some hook. */ function ...
-1
votes
3answers
79 views

Does WP have a hook for the use of wp_trim_words?

I am using bootstrap to layout a simple webpage. I have also add some css (@media (min-width: 1920px) {..}) media queries which I use for different resolutions Now I hope WP has a hook which checks ...
1
vote
0answers
310 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. ...