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

learn more… | top users | synonyms

18
votes
9answers
11k 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 ...
6
votes
2answers
270 views

WordPress Internal @ Mentions

I'm looking for a way to link to author pages within one WordPress install simply by putting the @ symbol in front of a person's username in a post.... just like on twitter. Example: If the username ...
5
votes
1answer
443 views

Content over 10,000 characters won't display with the_content()

A friend of mine just noticed that their site wasn't displaying pages that had a lot of content. For some reason they are just blank, and if he removes some content from the page it will display ...
5
votes
1answer
105 views

Add whitespace between Chinese and other letters

I want to add a space between a Chinese character and a letter or a number to make the article more readable. For example: Google与Apple展开的专利大战在2天之前结束。 Google 与 Apple 展开的专利大战在 2 天之前结束。 But ...
5
votes
1answer
839 views

Using preg_replace to separate gallery from the_content?

In a Wordpress theme, I need to separate a gallery from the rest of the_content. I think one could do that with get_the_content and preg_replace but it's a little beyond my skill level how to actually ...
4
votes
2answers
876 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 ...
4
votes
1answer
3k views

why doesn't the_content() work in this {single-custom_post_type.php} page?

This code is from my page single-publication.php. It outputs the relevant custom fields etc (here wrapped in template tags), but the_content() won't output the post content. I've resorted to using ...
4
votes
1answer
4k views

How to appending to the_content using add_filter with custom post type?

I have a custom post type running fine, but some of the text in the page is the same for every post, so I want to add it in using a function. I have this set up: function ...
4
votes
2answers
9k views

Get content from one page and show it on another page

So, I've been googling and reading and testing and failing. I'm fairly new to php, so don't expect to much :) I'm working on a new design, and I want to show content from the about page on my ...
3
votes
3answers
1k views

How to wrap an element around an iframe or embed in content automatically?

Id like to have wordpress automatically wrap a div around any iframe or embed when they are used in the_content...how might this be achieved?
3
votes
2answers
228 views

Heartbeat API oEmbed

By default running content through the_content filter automatically checks for oEmbed content. However when returning data through heartbeat_received the filter for oEmbed doesn't seem to work. For ...
3
votes
1answer
491 views

Custom filter for the_content doesn't work correctly

=====THIS POST HAS BEEN UPDATED===== SCROLL TO THE BOTTOM TO READ THE UPDATE! I asked a question yesterday that a gentleman named Tim was nice enough to take a stab at. He helped me through writing a ...
3
votes
1answer
41 views

Add Incrementing ID to each paragraph in the_content

I need to loop through each paragraph in the_content and add an ID to each paragraph with an incremental value. function incrementparagraphs( $content ) { for ($i = 0; $i <count($content); ...
3
votes
1answer
415 views

WordPress adding <br> tags into plugin content

We've written a plugin that shows reviews upon usage of a shortcode. On some sites, Wordpress is adding <br> tags throughout the shortcode content, and others it does not. The shortcode works ...
2
votes
2answers
2k views

What params are available with the_content filter?

I am looking for what params are passed to my filter function. Where can I find such info in the codex? http://codex.wordpress.org/Plugin_API/Filter_Reference/the_content didn't provide much info I ...
2
votes
4answers
3k 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 ...
2
votes
1answer
120 views

Modify the_content after the more tag

I have created a custom plugin that pulls video and images out of a post and puts them into a nicely formatted set of galleries. The only problem is that the plugin doesn't allow me to put a video or ...
2
votes
1answer
96 views

What functions are included in apply_filter('the_content')

There is a function called apply_filter where you can use it like this: echo apply_filter('the_content', $my_content); It add formatting tags and clean up the content. Trac or docs I looked in ...
2
votes
2answers
2k views

How can i remove all html tags from get_the_content()?

i want to remove all html tags from content like <p>, <br>, <img>, <a> i tried strip_tags() also tried $content = get_the_content(); $content = apply_filters('the_content', ...
2
votes
3answers
3k 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 ...
2
votes
1answer
307 views

Wordpress Wysiwyg Content not being displayed

My Wordpress website really isn't working to how I want?! It was working fine, with nothing being touched, Then lately I find every-page is displaying the same content on each page. Not the ...
2
votes
1answer
115 views

Sanitising post content for use in an email

I'm sending the content of a custom post type in a plaintext email (it's to send competition entries to a panel of judges), so I need to make sure that $post->post_content is correctly sanitised ...
2
votes
2answers
3k views

limit the words in the post content and add read more link

As you can see into the code, the routine is to display the post which has an id of 266. Now all I want is to limit the words displayed in the post content of that post. Let's say, I want to limit the ...
2
votes
2answers
374 views

Rendering Custom Post Types independently of the theme in use

By using a plugin called "Custom Content Type Manager", I have implemented in my blog a simple Custom Post Type called "game review" which is simple a post, plus some extra fields which represents the ...
2
votes
1answer
495 views

Add $more_link_text parameter to the_excerpt()

this filter is on the Wordpress Codex …  add_filter('excerpt_more', 'new_excerpt_more'); function new_excerpt_more($more) { global $post; return '<a class="moretag" href="'. ...
2
votes
1answer
63 views

preg_replace Remove comment text in content

In post content, i insert a text like below abc acb acb acb <!--REMOVE--> text to remove <!--ENDREMOVE--> abc acb acb acb abc acb acb acb <!--REMOVE--> text to remove ...
2
votes
1answer
125 views

Display the Content of a Post with qTip2

How would/should I use qTip2 to display the the_content(); of a WordPress post? I've been trying to accomplish this for a month now. I got it working once, but it wouldn't display the content that ...
2
votes
3answers
336 views

How to show video from specific category on sidebar?

I need to get video and content from recent posts in specific category called "Video" and show it on my sidebar. The problem is when I need to have limited text content. so, when I use the_content(); ...
2
votes
1answer
300 views

<p> tag the_content()

I'm trying to configure my content-page.php but i'm struggling with a few 'mistakes'. <article id="post-<?php the_ID(); ?>"> <div class="page_content"> <h1><?php ...
2
votes
2answers
264 views

Testing for post title in 'if/else' statement returns no content

I'm testing for a certain fixed post on an about page, I guessed that the best way is to test for post title (?). Here's my code, what's going wrong? <?php if (is_page()) { ...
2
votes
2answers
2k views

How to to stop html editor from addig <p> tags to shortcodes, images, etc

I know this this is covered as individual topics but What I am looking for is a single function that stops <p> tags from being wrapped around via the Wordpress editor to shortcodes and images ...
2
votes
1answer
534 views

Replacing with(out) regex link to attachment by links to files

I tried to do it myself but I have really hard time with Regex (regex is hell. I just don"t understand). Anyway, I think this would be usefull to some people. The context is that we use a plugin to ...
2
votes
1answer
70 views

Template Page Content Made Searchable

I'm migrating a client site over to a WordPress CMS. I made templates for each of the pages that would have static content: about us, facility, FAQs, etc. The problem is that this content seems to be ...
2
votes
1answer
902 views

the_excerpt(), get_the_excerpt() and the_content() all killing “the Loop”

Before I call the_excerpt(), the_permalink() displays the correct thing. Afterwards, it does not... <?php global $query_string; //strip out the ...
2
votes
1answer
643 views

Add span to the first letter of post

Example post <p>Lorem ipsum dolor sit amet</p> <p>Morbi elementum odio vel tortor adipiscing vel tempor risus ullamcorper.</p> What I have done : function ...
2
votes
1answer
163 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 ...
1
vote
3answers
2k views

Insert Ad Code in the Middle of a Post

I want to insert an ad code in the middle of a post via functions.php. I found several links but either they don't use functions.php or don't insert the code in the middle. Can anyone tell me how to ...
1
vote
2answers
8k views

Adding a div class or id inside the_content()

I'm trying to create an advertisement block to be placed on a single post (single.php) such that the div class or id is left aligned and the post content wrapped around it. I checked the single.php ...
1
vote
2answers
811 views

How to apply content filter permanently?

I have the following temporary filter to fix a content error. We have data in our posts that have 4 digit zip codes, because the leading zero was cut when the original file was created. (For instance, ...
1
vote
2answers
182 views

Output 2 items within the Loop

I have a query that loops through <li>'s and displays the number of <li>'s I have. Is there a way I can make the loop pull 2 <li>'s at a time rather than one? // 5 list items ...
1
vote
2answers
369 views

the_content is always surrounded by paragraphs (how to disable or remove them)?

the_content is always surrounded by paragraphs, it doesn't matter if I'm in HTML view and there's nothing there. Does WordPress have a function to remove them? IS there any way?
1
vote
4answers
602 views

How to add an inline style to the <p> tag outputted in the_content() using PHP?

I am trying to add an inline style to my paragraph tags which are ouputted using the_content(); I've tried string replace, see question I did earlier. But it won't because the_content echo's it and ...
1
vote
2answers
420 views

Filter the_content() in the Quote Post Format to Display Quotes

I'm customizing a theme for a client and I want to leverage post formats. On the quote post format I would like the_content(); to be wrapped in a two spans that contains quotation marks that I ...
1
vote
1answer
2k views

Add Class to Specific Paragraph of the_content()

Let's say I want to give the first paragraph bold text by adding a body class to the first paragraph. Is there a way to filter the output of the_content(); or any other paragraph? First paragraph? ...
1
vote
3answers
602 views

Finding the paragraphs in content

I am trying to create two functions, one that catches the first paragraph of some content, and one that catches the rest, but I have hit a bit of a conundrum. I have this in my single.php: <div ...
1
vote
3answers
488 views

Divide Post content into separate divs for every 500 characters (or any other character counts)

What is the best method for intercepting the_content of a post (for a single post page) and dividing the_content into sections of 500 characters (or any other number of characters), and then ...
1
vote
1answer
502 views

How can i display the content in plaintext

i want to display my excerpt in plaintext. How can i do this? This is my Snippet where i display the content: <?php the_content(__( 'Weiterlesen &rsaquo;','okay')); ?> How i change the ...
1
vote
1answer
78 views

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

Is there possible to automatically add for example image before first h2 in the_content ? Thank you
1
vote
2answers
187 views

Combining the_excerpt with the_content

I have some html: <div class="container"> <p class="accent">The first paragraph...</p> <p>The rest of the article...</p> </div> I'd like to put "the_excerpt" in ...
1
vote
3answers
4k views

Why is the_content() not displaying the content? [closed]

in my wordpress site, the_content() is not showing the content, but $post->post_content shows it, why this is happening? and how can I use the_content again?