The the-content tag has no wiki summary.
13
votes
9answers
7k 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 ...
5
votes
1answer
285 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
66 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 ...
4
votes
1answer
2k 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 ...
3
votes
1answer
2k 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 ...
3
votes
1answer
439 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 ...
3
votes
1answer
300 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
2answers
4k 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
1answer
243 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
3answers
516 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?
2
votes
1answer
85 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
30 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
1answer
181 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
75 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
1k 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
287 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
32 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
1answer
122 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
748 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
58 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
731 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
534 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
2answers
71 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(); ...
1
vote
2answers
1k 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 ...
1
vote
3answers
650 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
5k 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
745 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
65 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
317 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
2answers
209 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
3answers
417 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
2answers
55 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', ...
1
vote
3answers
999 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 ...
1
vote
2answers
130 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
1answer
86 views
Loop after page content
I just upgraded to 3.4.2 from 2.9 (i know, i know, but if it ain't broke...) I have page templates that are (or at least were) set up to display the page content first, then start a loop of posts, ...
1
vote
1answer
857 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
1answer
434 views
How to encode post content as JSON?
I`m trying to construct a json object but are having difficulties with the_content since it returns newlines, which causes the script to fail. The error messages received is: Uncaught SyntaxError: ...
1
vote
1answer
271 views
Split the content of the_content();
I want the content before the <!--more--> tag in one column and the rest in another column (single.php) only.
I don't want to use plug-ins where I would need to edit all the posts to get it as ...
1
vote
1answer
191 views
the_content() isn't showing content, but $post->post_content does
I'm trying to echo the content of a single post by using the_content(); but I get an empty result. However when I directly address the global $post, and specifically the post_content property it does ...
1
vote
1answer
113 views
Appending code to the_content
I'm trying to append some php code to the_content in a custom loop. I do not want to add a function because I only want to append the code to one instance of the_content, not throughout the whole ...
1
vote
1answer
250 views
Exclude the_content (); from page password protection
I use a page template to show custom post type.
All content from the custom post type should be password protected. I´d like to use the wordpress editor for some additional public information. Can I ...
1
vote
1answer
176 views
Nested calls the the_content filter
I'm writing a plugin that adds some custom content near the end of a post (or page). So I've added a filter for 'the_content', and the plugin adds its content there. Mostly, it works.
However, some ...
1
vote
2answers
93 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()) {
...
1
vote
2answers
141 views
How to split <p> text text text </p> into array
I like to output and style in a shortcode, but the content that is get is the content of a page, so it's style like that
<p>2012-12-12</p>
<p>2012-6-23</p>
...
1
vote
1answer
73 views
Function to show only first instance of shortcode
I need to add a function to my theme to remove additional instances of a shortcode in a post.
First off I wonder if i'm approaching this wrong, but I have a theme that is drastically reformats the ...
1
vote
2answers
129 views
Accessing Media/Files outside the_content
I'm building a site and each post has a PDF file attachment. Is there a way I can access that file outside the_content() on a single post page? I'd like to put the file attachment in a sidebar and not ...
1
vote
1answer
429 views
add data-attribute to all images inside the_content()
I wonder if it's possible to add a filter to all images inside the_content() to create the following image pattern for all images …
<img class="digest" src="smallest-file.jpg" ...
1
vote
1answer
302 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="'. ...
1
vote
1answer
1k views
How to correctly limit the content and strip HTML?
I have been using this code for a long time :
$temp_arr_content = explode(
" ",
substr(
strip_tags(
get_the_content()
),
0,
720
)
);
...
1
vote
2answers
584 views
Hook midway through the_content();?
Basically, I want to add a function that executes half way through the_content();
I want to add a message/ad block whatever in the middle of all of my content without having to go in to each ...

