Tagged Questions
2
votes
1answer
31 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 ...
0
votes
2answers
142 views
Removing any and all inline styles from the_content()
For one of my current projects, I had to transfer blogposts from an old Wordpress site to my project.
Things went smoothly until I've seen that all the posts were copy pasted from Word, leaving this ...
0
votes
1answer
62 views
Is it possible to remove next-post / previous-post with out creating a custom template?
I'm creating a plugin that uses a custom post type. I do not want to make a custom template for viewing the posts and discovered I can add a filter for the_content to include my custom fields, this ...
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 ...
0
votes
1answer
81 views
Why does apply_filters behave different inside and outside a loop?
What I want: the array of posts returned by creating $query = new WP_Query($args);
Why: to return specific content as a sort of API request in json format, ready to display on another site
What I ...
0
votes
1answer
60 views
Can / should a widget plugin define its own Widget Area?
Should a plugin be able to add a widget area above the_content? (Without requiring template/theme changes.)
What would be the best way to do this?
Doubts: widgets typically echo output to the screen; ...
0
votes
1answer
126 views
add_filter to the_content after apply_filters
I have a shortcode that outputs null ("").
What I'm trying to accomplish is to output a default message if the shortcode outputs null. I don't want to extend my shortcode because there may be ...
1
vote
1answer
177 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 ...
0
votes
1answer
160 views
Filters on the_content with plugins, pages and shortcode
I am using a plugin to add tweet, likes... This plugin add filters to the_content() to display this social buttons on a blog page (list of posts).
I coded a shortcode which does a custom SQL query ...
2
votes
3answers
519 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?
1
vote
3answers
1k 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
0answers
91 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
1answer
276 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 ...
0
votes
1answer
469 views
post->post_content filter
I'm trying to determine if the REGEX I'm using is incorrect -- or if I'm missing something basic here. The following:
add_filter('the_content','wpdu_image_replace');
function ...
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
862 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? ...
0
votes
2answers
500 views
embed the_content
Im trying to wrap video urls and embed code in a classed div so that I can style it. The vid code is being pulled from the custom meta value I've setup for the video post type. Nothing I've been able ...
3
votes
1answer
301 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 ...
0
votes
1answer
119 views
How do I assign this filter to a variable? (Appending php & markup to the_content)
===I HAVE SOMETHING THAT WORKS NOW, JUST NOT CORRECTLY. PLEASE READ THE WHOLE POST, I AM GOING TO LEAVE IT ALL UP HERE BECAUSE OTHERS MAY BE ABLE TO BENEFIT FROM ME BUMBLING THROUGH THIS PROCESS!!
I ...
0
votes
1answer
364 views
How to prepend text to the_content, but after img/shortcode
I was trying to add some text to the beginning of every post (the text comes from post_meta, but for this example let's assume it's static text).
Here's what I tried:
add_filter('the_content', ...
1
vote
2answers
1k views
What is the filter hook for custom fields content?
The following code hides "the_content" output
add_filter( "the_content", "cp_module_pcontent_post_content" );
function cp_module_pcontent_post_content($content){
global $post;
...
0
votes
0answers
2k views
How to use `the_content` filter properly? [closed]
I have a plugin that filters a particular page, and another plugin(a widget actually) that uses WP_Query to display a number of posts list. The problem is when I am on that particular page that is ...
0
votes
1answer
77 views
While there is content; applying filters in blocks [closed]
So I'm trying to filter content and get it into 1400 character blocks (or there abouts, using </p> as separation points.
I can do this. My question is (hopefully) a simple PHP one (I am still ...
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 ...
0
votes
1answer
2k views
add_filter for specific pages
Is it possible to add this filter
add_filter("the_content", "magicalender_get_event_page");
But only for one specific page, for example
if($post->post_name == "magicalenderpage")
If I put the ...
0
votes
1answer
229 views
Help with add_filter('the_content', 'some_function') and multiple matches
I have a site where a user can insert slideshows into a post by entering the shortcode in the content box. He can also add videos by adding the video code in the same box. I need to separate these two ...
0
votes
2answers
896 views
How can I remove filters from custom post types?
I created a custom post type which I'll use as landing page for PPC. Now on that custom post type I would like to remove all the filters which are adding the social media buttons for example. I tried ...
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
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, ...