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
20 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 ...
-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 ...
32
votes
10answers
26k views

Stop Wordpress Wrapping Images In A “P” Tag

I have searched high and low for a simple solution to this, but to no avail. Wordpress keeps on wrapping my images in p tags and because of the eccentric nature of the layout for a site I am working ...
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
27 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
33 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
767 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
50 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
632 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
66 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
301 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. ...
0
votes
1answer
369 views

Edit value of the_content() before showing

I have a task that needs to insert ad-tags in the middle of the_content() value. But I got confused because I can't break down the value of the_content(). Is there any way to put some code in the ...
0
votes
2answers
21 views

Getting content from a referenced post

I have the following, which is successfully pulling the title, thumbnail, and custom field data (YouTube link) from a referenced post, but the content displayed is that of the parent: function ...
1
vote
1answer
36 views

Removing the_content() from the page

There is the_content() in one of the template files which, well, prints the content. I get the content with get_the_content() manipulate it and print it. However, I couldn't figure out which action ...
1
vote
0answers
31 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. ...
0
votes
1answer
20 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
2answers
54 views

Is it possible to change the structure of the HTML generated by the_content()? If yes, how? If not, is there a workaround?

Suppose the editor on my admin dashboard creates the following HTML (when I print to the webpage using the_content(): <blockquote>Hello this is the best quote in the world!</blockquote> &...
0
votes
1answer
142 views

Get the_content surrounded by <h1> instead of <p>

I'm looking to use the_content() on a particular page, but I want it to be surrounded with an <h1> instead of a <p>. I've tried doing this: $thisPagesContent = the_content(); echo '<...
1
vote
1answer
98 views

Changing the HTML Of the content

<?php the_content(); ?> When we use the above the content is published like this → <p>Content is published</p> If I want to later this HTML and instead of <p></p> I ...
2
votes
2answers
7k views

Remove empty lines (&nbsp;) when author updates their post

Whenever adding an empty line between paragraphs using TinyMCE, the &nbsp; character entity is added. How can I strip the content of all instances of this character whenever an author updates ...
1
vote
2answers
303 views

Why content_arr['extended'] removes paragraph tags?

I am running into a strange issue where content_arr['extended'] or content_arr['main'] is removing the paragraph tags in the output. Any help, or insight into something i am over looking, trying to ...
1
vote
1answer
248 views

Editing <?php the_content('Read more…'); ?>

Is it possible to automatically add for example image before first h2 tag in the_content?
1
vote
2answers
97 views

Save the_content into custom field

Is it possible to save the content (inside the WP WYSIWYG (the_content)) into a custom field? This is what I have so far: add_action('edit_post', 'save_content_to_field'); function ...
0
votes
1answer
1k views

$content = $post->post_content; with formating

I'm trying to get formating but with no luck. My code looks like this global $post; $content = $post->post_content; And to output here <div class="tribe-events-single-event-description tribe-...
2
votes
1answer
1k views

custom post type grid with content in lightbox [closed]

I'm going around every single wordpress plugin and impossible to find something with this featured . . . . I need a grid list of some custom post type - with inline filter. This is fine and tons of ...
-1
votes
2answers
69 views

Single Loop With Dual Content Area

Is there a way to implement a single loop with dual content area. E.g. A single loop having 2 of <?php the_content(); ?> Dinstinguished as shown bellow with video and write-up respectively ...
0
votes
1answer
324 views

Post content being duplicated by the_content();

I have a query that runs through a set of posts with the post type location. It returns them broken down by a custom field value (in this case, the state in which the location is located). For some ...
4
votes
4answers
8k views

Modify 'Read more' link adding a new class

I want to add a class to the 'Read more' link. Actually I have this: <?php the_content( 'Read more...' ); ?> Which outputs: <a href="...?p=14#more-14" class="more-link">Read more…</a&...
0
votes
1answer
52 views

Insert template-part inside the content

I want to display an image/banner with link, inside the content of the posts of my blog. Neither at the beginning, nor at the end. It should appear somewhere inside the content of the post. I don't ...
0
votes
1answer
58 views

How to split a post and intercalate elements from a loop

What I'm trying to achieve is spreading related posts throughout the content - such as one reccomendation after every 3 paragraphs. As I see it, three things need be done: 1 - Do the loop. What I'm ...
-1
votes
1answer
19 views

Exactly where I have to insert get_next_post_link() in a post?

Currently I'm working on a website, where there are posts and I intend to give the possibility the user to jump to the adjacent posts with a simple link pointing to them. It will be with ...
-1
votes
2answers
4k views

How add class the_content();?

How do I add a class the_content();? <div class="csoporszoveg"> <h3 class="csoporcim"><?php if ($settings['enable_link']) { echo '<a href="' . get_permalink($...
0
votes
2answers
67 views

Use content from one page in another template

I'm quite new to WordPress and wonder if there is a way to take the content in a normal page created in WP and show this content in a div tag through a page template? The setup is two divs next to ...
6
votes
3answers
4k views

Remove specific shortcode from get_the_content()

I have a variable like this: $post_content = get_the_content(); Here I want to remove some specific shortcode from the $post_content variable e.g I want to remove only this [video height="300" width=...
2
votes
1answer
1k views

How I can split text in the_content() into 2 columns?

I need to split one paragraph of text into two columns in wordpress the_content(); I tried different tutorials, but they not work for me. Also I can't use shortcodes. Here how I need to make it done: ...
1
vote
1answer
173 views

Searching for content post

I need the "wordpress search" engine to be only for the content of the posts. I looking for some solution but always "wordpress search" engine only shows results by titles of the post. What can I ...
2
votes
2answers
4k views

Difference between the_content() and get_post()?

I'm working on tweaking a theme and I need to explode the post content to remove some text. The following code is what I am using: $custom_Get_Post_Title = explode('|',get_post()->post_content); ...
0
votes
2answers
912 views

alternative to the_content filter

"i am using the_content filter on the category pages like cat=1" I am appending --N in the content. But due the the theme functionality it strip the content after some number of characters therefore ...
0
votes
1answer
702 views

the_content not showing responsive image attributes srcset or sizes

I'm using WordPress 4.4.2, but am unable to get the new responsive images functionality to appear for the_content. It works for featured images, just not the_content images. I have no plugins ...
0
votes
1answer
1k views

Insert div after h2 in content

I'm trying to insert a div with a small bit of content immediately after the /h2 of single posts. I've given single posts a new class to help trigger this, as I don't want it after the /h2 on a page. ...
0
votes
3answers
2k views

Getting first 20 words without excerpt

I'm working on my own custom theme (first custom WP work so I'm a real beginner) and need help in listing the first 20 words of a list of recent posts. I managed to solve this with manual? excerpt ...
0
votes
3answers
250 views

Why do images inserted in the post content via the_content() go off the max-width?

I have many containers over the said image itself such as col-md-10 which defines a max-width of 80% or so, this is how I generate my post: <article id="single-post-<?php the_ID(); ?>" <?...
0
votes
0answers
117 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
1answer
482 views

How do you get specific tags from the_content?

How would I grab specific tags from the_content? For example, I'd like to pull a list of all h1 tags.
0
votes
1answer
24 views

use a Thumbnail size in post

When inserting a image to WordPress post, I have used size as "Full Size" for all images. My images width are between 800px to 1500px. Is there way to change it for whole site when displaying on the ...
0
votes
1answer
37 views

Why is overwriting $GLOBALS killing the_content()?

I'm in the single.php and now need to use the_content() instead of just $post->post_content; for youtube embeds etc.– in other projects the_content() and apply_filters("the_content", ...) does ...
0
votes
1answer
144 views

Insert wp_query after the_content with plugin (filter the_content won't work)

I would like to insert a wp_query after the post content. After looking in different website, they all suggest using a filter on the_content. Example: add_filter( 'the_content', '...
3
votes
2answers
715 views

How to ensure “the_content” filter runs only for the main displayed content?

I have a plugin which adds the method to "the_content" filter. add_filter('the_content', 'myFilteringFunction', 10000); Within that function I want to add some links on the beginning and the end of ...
0
votes
1answer
41 views

the_content(); erroneously closing off previous opening before it

I have a custom loop that is displaying a "most popular" posts section. It first creates a linked container (<a href="<?php the_permalink(); ?>"> ... </a>), and then stores data from ...