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

learn more… | top users | synonyms

1
vote
5answers
378 views

How to use wp_rel_nofollow to add nofollow to external links only?

I want to add nofollow attribute to only external links in the content of the post. Internal links should stay follow. So, can I use wp_rel_nofollow() to make only external links nofollow? Or do I ...
1
vote
2answers
843 views

put the content of a single post into og:description

I'd like to have the content of the current single post loaded into the og:description meta property - but the '. $content .' doesn't output anything? This is what's in my header.php if ...
0
votes
4answers
1k views

How to limit the characters shown on the page - get_content

I've the below php to display the content of the post id#9 on my 'home page' of my site, so that whenever the client updates the page, it's reflected on the homepage as well - rather than having to ...
0
votes
0answers
21 views

wp query doesn't return html tags

In file I have the following (only part is showed below): <?php $args = array( 'name' => 'contact-us', 'post_type' => 'page' ); $q = new WP_Query($args); ...
0
votes
2answers
432 views

Can i use multiple 'the_content' filters?

I am currently using a 'the_content' filter to add some HTML to the bottom of my posts and pages. But, I want to add another 'the_content' filter to a handful of specific pages (using page IDs). Is ...
1
vote
1answer
34 views

'the_content' filter removing html tags from post content

I have a post content(html) like this: <div id="home_tabs"> <ul> <li><a href="#tabs-1">Nunc tincidunt</a></li> <li><a href="#tabs-2">Proin ...
0
votes
1answer
20 views

How to add content with a filter when there's no content in the editor

I'm building a plugin to create page sections (with ACF and repeater field) and I want to add the sections at the end of the content. The sections are added to the content, but only when there's ...
0
votes
1answer
540 views

the_content() “crashes” for single pages

I have big trouble with the_content() for single.php. Whats my problem? the_content() doesn't give any output on single pages furthermore it crashes (no other PHP code below the function call is ...
4
votes
1answer
38 views

Add post/page ID to inserted links within the_content

Within the main content editor of posts and pages, we can insert multiple links to other posts/pages: <a href="http://example.com/hello-world/">Hello World</a> What I am trying to do is ...
0
votes
1answer
22 views

Change Content for Specific Page

I want to be able to replace a page's content if it is a very specific page. Here is what I've written so far: function signup () { global $post; $slug = $post->post_name; if ...
0
votes
1answer
15 views

Hook added to the_content seems to be called multiple times

I have the following code running in a plugin: add_filter('the_content','thousand_pay'); //Callback function function thousand_pay($content) { echo $content; if( !in_category( 'Stories') ) ...
3
votes
2answers
34 views

Where to hook into post content?

Which hook or filter is used to edit the post content before the_content filter is applied to it. For instance, if I wanted to add Hello World, as the first text in every post.
0
votes
0answers
11 views

Disable wp_link_pages() function from theme through plugin [duplicate]

Spent couple of hours trying to fix the problem but I couldn't. Hope you guys will give me some insights. I'm writing a plugin to include the wp_link_pages() functionality. I'm adding it with the ...
0
votes
1answer
16 views

Cannot Find Hook that is changing the_content()

I am working with a wordpress theme that is using Foundationpress as it's starter theme. When I use the_content() all img tags have there css class replaced with image. This is overwriting the ability ...
1
vote
1answer
414 views

How to ignore or disable nextpage tag?

I have this site that uses the <!--nextpage--> tag in posts for pagination purposes. I want to disable pagination, but without deleting the tags for the database (maybe they'll want to use them ...
1
vote
3answers
105 views

get_the_content not working in loop?

I am trying to modify my loop to save post data by category. I found some code on this site that saved the post's titles based on their categories and tried to modify this to save the post's content. ...
1
vote
1answer
73 views

Filter only the text in the_content

I tried to filter only the text in get_the_content for my home page, but its including my shortcode also, because in that page first row google map 2nd row text box i am using visual composer page ...
0
votes
2answers
458 views

Include custom fields into the content of a regular page

Here's my setup: Parent "Gallery" page: _regular page, not custom type or anything _ Several "Project" child pages (could be as few as 1, unlimited number): also normal pages Child pages will ...
0
votes
1answer
51 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 ...
3
votes
1answer
47 views

Apply the_content filter for specific post types only

I'm trying to modify a snippet of code I found here for a wordpress website: http://support.membermouse.com/support/discussions/topics/9000007386 Here is the code: <?php add_filter( ...
0
votes
3answers
25 views

WordPress Load Only Page Text

I'm working on a page template and I need the_title to be separate from the page text. I'm not sure how to load the_content without it having the title. Can anyone help?
0
votes
0answers
23 views

pre_get_comments or the_content filter

I am learning wordpress deveplopment. I have a litle problem for understand how to use the right hook for add my code. In this case I have to ask... what is the best practice for show social icons ...
3
votes
1answer
2k views

Add something to beginning of the content

I'm using add_action('the_content', 'myFunction', 10) to append data to the end of the content. How can I place content at the beginning of the content?
0
votes
2answers
47 views

Display specific page (that is child) content on parent page

I have problem displaying child page content on parent page (both static). I can display other page content but only if on same level. It dosent work in relation parent - child. <?php ...
0
votes
1answer
28 views

Using shortcode to stop post content from displaying

Is there any way to use shortcode to block the display of the post content? What I want is to use the shortcode to pull the post content directly from the database, manipulate it, and then display it ...
2
votes
3answers
5k views

How do I add the featured image to the_content after the first paragraph?

My problem: I'm trying to create a filter that will add the featured image of a post to the_content, so that I can have the first paragraph of the_content displayed before this image. What I basicly ...
0
votes
1answer
32 views

How do I set the content for a post of a particular CPT?

I have a CPT called Contest. When a contest is created or updated, I want to manually set the value of the post content to my shortcode from my plugin. I have custom metaboxes that I use with this ...
2
votes
3answers
249 views

How to disable content pagination?

I want to totally disable this functionality from WordPress because I'm implementing my own version of this with Javascript. When I try to grab all the content in a post via the get_the_content() or ...
0
votes
0answers
26 views

WP_Query pulling all content even with readmore

I'm using a plugin called quicksand that is working for the most part. It hasn't been updated in 2 years though so support there isn't an option. I just noticed though that even though I'm putting a ...
-2
votes
2answers
34 views

How to remove only images from the_content() [duplicate]

When I call the_content(), I want to show only text and don't want to show images. Notable that, I don't want to remove text style. The text style should be display as well. How can I do this?
-3
votes
1answer
34 views

Create a shortcode to display the “the_content ()” in my post [closed]

I should create a shortcode to display the contents of the post in my template. Could someone help me? I made a shortcode to display the form of comments, this just can not unfortunately. Thanks ...
3
votes
3answers
150 views

Get random custom-post-type post to display within content

I have a function, within functions.php (all code below), that adds an advertisement after x amount of paragraphs to any given single.php post. I have a custom-post-type called advertising that has a ...
-1
votes
1answer
40 views

add_filter adds output in the head

I build plugin and I have a problem I add to plugin: add_filter( 'the_content', myFunction); function myFunction() { $options = get_option('myPlugin_settings'); if ...
2
votes
2answers
5k views

Static page homepage not showing the_content

I must be doing something wrong here. I setup my site with a static front page using front-page.php. I created a page in the admin with a title and chose the front-page.php in the template dropdown. ...
5
votes
1answer
108 views

Change appearance of shortcode text inside editor

Is it possible to change appearance of shortcodes in editor or in whatever way make it more distinguishable from surrounding text? For example if the content of a post is like this... Reference ...
1
vote
0answers
22 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 ...
0
votes
1answer
59 views

Strip links from the_content

I'm trying to strip all the a href tags from the_content(); when displayed on the front end. If I use get_the_content(); and preg_replace it works fine, however, get_the_content doesn't show ...
1
vote
0answers
32 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
1answer
61 views

Displaying recent post excerpts on static front page

I'm trying to display a static front page with recent posts at the bottom. Specifically, I want to display just an excerpt from the recent posts, as would be returned by the_content() if I had a ...
11
votes
2answers
6k views

Split Content and Gallery

Is there a way to split up the post content and the gallery short code. I want to display the gallery outside my normal content no matter how or where it is placed. I can use this to get the shortcode ...
0
votes
1answer
36 views

custom page with post content using read more

I have a code for a custom page i'm creating that I want to have my own blog archive (formatted customized) this is my code: <?php ...
4
votes
2answers
103 views

Using variable from one filter in another filter

I have a filter for the Gallery Shortcode where I grab IDs for images used in a post and using the IDs I grab their meta data. Now I need a way to use the $copyright variable in a filter for grabbing ...
0
votes
1answer
30 views

Create a Wordpress shortcode using PHP [duplicate]

I am currently using the following code within single.php (after the_content) This gets the store_name from custom field as $merchant from the post and then returns a list of products from that ...
2
votes
2answers
103 views

Automatically insert php function into post $the_content

I am trying to have 2 php functions automatically inserted in every post for my CPT. The problem I am having is that even though I've found a way to add text, Im not sure how to add the php functions ...
7
votes
3answers
1k views

the_content and is_main_query

I am filtering the content with the the_content filter. Everything works perfect, excerpt that my changes are applied to custom queries as well. My changes appear in the sidebar as well if the widget ...
1
vote
2answers
60 views

What is the proper way to get contents of a page?

The goal is very simple - to print page content on a page. I tried: <?php the_content() ?> <?= get_the_content() ?> then <?php the_content(get_the_ID()) ?> <?= ...
0
votes
3answers
74 views

The Content is not Wraping in <p> tag

Can you please take a Look at this page (please hove over the image to see the paragraph) and let me know why the the_content() is jumping out of paragraph tag? echo '<p style="color:#fff ...
0
votes
1answer
18 views

How to best adjust images to a max content width of 490px?

On a large blog with thousands of images there are posts published by people who do not know much about image optimization. I am searching for a plugin or even a simple wp_content filter function in ...
0
votes
0answers
26 views

Problem with the_content() and &nbsp

So everything looks normal when I type something in my WYSIWIG, it get outputted by the_content() on the page like this: But when my colleague does the exact same thing, it does this: Every word ...
0
votes
3answers
98 views

Add review box by function at top or bottom of content

Filter add_filter( 'the_content', 'sandy_posts_filter' ); function sandy_posts_filter( $content ) { global $post; $review_box_pos =get_post_meta( $post->ID, ...