Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

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
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
35 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
2answers
65 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
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
1answer
284 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
101 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 ...
1
vote
2answers
106 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
2k 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-...
0
votes
1answer
383 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 ...
0
votes
1answer
58 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
73 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 ...
0
votes
2answers
68 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 ...
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
300 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 ...
3
votes
2answers
5k 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
1answer
1k 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 ...
0
votes
3answers
3k 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
278 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
131 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
564 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
38 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
172 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', '...
0
votes
1answer
47 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 ...
1
vote
1answer
48 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 ...
0
votes
1answer
132 views

Apply a filter str_replace on specific caracters array in the_content()

I am trying to create a filter for the_content() where I would be able to aply a str_replace() on specific caracters array(). At the moment, I have it working for only one caracter. I would like to ...
-1
votes
1answer
186 views

append code after the_content not working

Goal: Add pagination below single post pages. Code function add_pagin( $content ) { if ( is_singular('post') ) { $content .= previous_post_link() . next_post_link(); } return $...
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 ...
0
votes
1answer
284 views

The_content and Preg_replace in loaded Iframe [closed]

The Problem: I try delete the tag generates by a iframe after is loaded. The iframe is for load a video but then it loads some tags like this <div role="contentinfo" class="dmp_VideoInfo dmp_is-...
0
votes
1answer
50 views

Don't allow JavaScript in the content area

Is there any way to disable or remove JavaScript in the page/post content area? So if there was any <script> tags it would remove them or ignore them when outputting the_content();
0
votes
1answer
41 views

How to insert link, with lightbox, that opens specific page content only

I need insert link next to Woocommerce product addon label, that sould act as pop-up on clic, and open content of one specific page. I have successfully done it by js and hardcoded url. But: Pop up ...
0
votes
2answers
62 views

Extract links inside embed tags in WordPress

I am using the default WordPress embed to embed a couple of videos in the content. I want to extract the video link from [embed]https://www.youtube.com/watch?v=Z9QbYZh1YXY[/embed], can anyone help ...
0
votes
2answers
49 views

Load Posts' individual body content on index starting at char 200 of each post

I would like to have my index or posts overview page load each post teaser starting at char 206 of each post's body content. This as all posts start with a general introduction in the post body ...
0
votes
2answers
164 views

Looking to limit the number of characters on my post page

I want my posts to be limited to number characters. I want this to happen on the page that shows all my posts. I am using this snippet. The read more link also appears when you are viewing the single ...
0
votes
1answer
306 views

add_filter to the_content from plugin function

I am using myeffecto plugin for post reaction.The plugin shows emoticons using the_content hook.But i don't want to show it on every posts.i want it in a conditional if() statement the plugin uses: ...
0
votes
1answer
502 views

content-single.php does not display the_content()

In my single.php I have this <?php while ( have_posts() ) : the_post(); get_template_part( 'template-parts/content-single', get_post_type() ); endwhile; And my content-single.php <div ...
0
votes
2answers
208 views

How can I display “read more” without any other post text?

I have created the Read more in my posts, but when I add the php tag <?php the_content(); ?> ...it shows the post content with read more button. I only want to display the button, with no ...
-1
votes
2answers
5k 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
1answer
283 views

$content is empty while using DOMDocument

I'm trying to modify the Image Output on my Wordpress-Site to replace src and srcset with their "data-" Equivalent while adding an additional class. Therefor I'm using DOMDocument and filter for imgs. ...
0
votes
1answer
42 views

Excerpt is being added above the content, but it should be after it

I have this code in my functions.php file to display the excerpt of every post right below the content of every post. But, for some reason the Excerpt is appearing above the Content when it should be ...
1
vote
1answer
79 views

WordPress get_the_content get child element like p value

I am developing web site by wordpress in case my problem I want to remove h1 and h2 tag in from main page. I want to get only child p tag by get_the_content() <p id="main"> <?php echo ...
1
vote
1answer
4k views

shortcode not working and the relation to the_content()

Reference Post (I was even downvoted here.) My short code was not working on my custom theme, but the same short code, when used in twenty fifteen, was working. I researched over google and found ...
0
votes
1answer
38 views

Separate Content from gallery (custom post type)

i have a php file (single-model.php) who display in one div first the post content and than the gallery in thumbs. How can split the content from gallery and display the gallery in diferent div ..? ...
1
vote
1answer
1k views

Proper way to use get_the_content() in front-page.php and the content-home.php?

<div class="class1"> <ul> <li> <div class="class2"> <?php the_post_thumbnail( 'large') ?> </div> <...
0
votes
0answers
97 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
1answer
328 views

after setup_postdata, the_content() only displays text before the read more tag

I'm building a traveling-page and i need to add the description of a train or a ship into the description of a trip. My code looks like this: <?php if (!empty(rwmb_meta("train_ship"))) { ?> ...
0
votes
1answer
70 views

Balance Tags to the_content Words Length

I have a category page that I need to show some of the content of a the posts with HTML tags such as images. Site - http://hoffwebsites.com/wp-hoff-testing/ms-conversations/ I have found this code ...
1
vote
2answers
339 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
2answers
735 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