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
0
votes
2answers
9k views

limit how many words show up in the_content on index

I'm having a heck of a time with this! I'm trying to force this page to only show a limited amount of words regardless if they insert a readmore tag. I was going to use the_excerpt, but it doesn't ...
5
votes
4answers
16k 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
2answers
36 views

WordPress Add advertising ads befor and after content with periority [closed]

How we can use function with filter to add ads before and after content, Every ad has its priority. How we can use parameters at function then use it at filter This is the function function ...
0
votes
1answer
78 views

wp_content text length and displaying 'more' for the full text

(Using wordpress)I tried to find out what's the php code to display the length text of content and likely a clickable 'more' under the content to display my full content when somebody click (like in ...
2
votes
2answers
2k views

Content editor creating blank paragraphs in spaces and creating &nbsp in the_excerpt

I see that in other sites that use wordpress this does not happen, so I would like to know how to space without creating a blank paragraph or a &nbsp ? As you can see in the image, in each space ...
3
votes
2answers
2k 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') ) ...
7
votes
2answers
9k views

Only show content before more tag

I am using the Siren Template. In homepage.php this code is used to display the portfolio content print_excerpt(200); But I to need show the content only before <!--more--> I have used this: ...
3
votes
2answers
3k views

the_content after all shortcodes are parsed

I am creating a WordPress Plugin for WordPress directory. How can I get the_content() after applying all the shortcodes that are presents in the_content? Let me explain: My plugin will be used in ...
0
votes
0answers
310 views

Why is every single HTML tag being stripped out of liveblog entries?

I have variously been using Livepress and the Automattic/Wordpress VIP Liveblog plugin as a live-blogging solution. However, I have run into an issue that does not seem specific to either plugin but ...
1
vote
0answers
119 views

Hide Gallery from the_conent

I'm using a function to separate Featured Content. What I mean is that: if I selected format Gallery will show the First Gallery in my post , if I choose format Video , will show a video instead . ...
1
vote
2answers
3k 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
2answers
339 views

Output Buffering - Everything between wp_head and wp_print_footer_scripts?

What is the best way to use "Output Buffering" on the frontend? In my case, I need to apply some regex rules to the content generated by a theme with a page builder. So it is not possible to edit ...
1
vote
1answer
2k views

page.php not displaying content

I am using a page.php template I have used on about 400 Wordpress websites, and all of a sudden the loop decides it doesn't want to display any content. Code is: <div class="text-content"> &...
0
votes
1answer
590 views

the_content() Not Grabbing All Content

I'm having a weird issue where Wordpress is cutting off and not grabbing all of the content from pages or posts. Examples can be seen on the following pages: http://gripjunkies.com/about/ http://...
0
votes
1answer
62 views

Find post tags words in post content and link them to tag URLs

I would like to create link of word(s) in post content (word(s) which is used as post tag of current post) to post tag URL. I created this, and it works, but only for one word (last tag) of post. $...
3
votes
1answer
9k views

apply_filters('the_content', $content) alternative

"the_content" filter can get added with other filters from plugins and themes which could alter content, when you simply want this to format the post_content to HTML format. Is there a better ...
0
votes
1answer
477 views

How to keep before/after text inline with nl2br and the_content()

I have "<em><?php echo nl2br(the_content()); ?></em>" but the two " are not inline with the content. How do I keep the before and after " characters inline?
4
votes
3answers
4k 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 ...
1
vote
1answer
825 views

why does the add_action('the_content) overwrite my page

I am new to wordpress and I am trying to display some text on specific pages on my website. My problem is that my plugin replaces my current content on that page with the one on my plugin. How can I ...
1
vote
1answer
69 views

How to make search and replace in content through php

I actually can show content and change content while displaying post. Problem is that I am using RSS importer and after importing I want to make search and replace and correct data imported because I ...
0
votes
1answer
906 views

Including Custom fields within the_content

I’m designing a site for a client and I’m using custom fields for buy links to her books. I only want buy buttons to appear for fields that contain a URL, so I’ve hooked this just below the_content: &...
0
votes
3answers
3k views

Get the Page Content,without generating HTML

I want to get the page content (so i can parse the tags/short-codes in it), but i don't want to output the result itself to the browser (i.e. echo=0). I tried get_the_content(); but its the same deal....
0
votes
1answer
59 views

Format content value from DB outside of WordPress filters

We're using WordPress to maintain data for a site that gets feed into a JSON file. I've noticed that the post content we add to our file is not getting formatted appropriately. So when we feed it to ...
1
vote
2answers
1k views

Wrap First Character after </h3><p> in a <span> tag

This is a continuation from a question I asked earlier about doing this with output from the_excerpt(). What I am trying to do is take the following output from the_content() to take the following ...
1
vote
2answers
921 views

How do I Add HTML to the_excerpt() & the_content() Output?

I am building a theme where I need to add a dropcap to the first letter. This would be done by surrounding the character in question with <span class="dropcap> and </span>. The actual work ...
0
votes
1answer
14 views

Is there a way to have chunks of a page's content expire?

I have a page on my site where I post items that have been discounted. However, each item's discount ends at a certain date. After that date, I don't want the item to be visible any longer. But I don'...
0
votes
1answer
38 views

Changing where my author box is printed

I've got a function in my functions.php that compiles author info for an author box. At the end of the function it return $content; I then have it being added to the end of the content like this // ...
1
vote
1answer
654 views

How to have a “clean” post content, for excerpt and social networks sharing

Sometimes I start my blog posts by : This is a guest post.... This is a sponsored post.... [download]This is a download for the post[download] [youtube]this is a video that I put in the begenning[...
1
vote
1answer
849 views

Function the_content not working

I'm developing a site with the Advanced Custom Fields and SF Taxonomy Thumbnail. In any page (post type = page), I'm with an error that I don't know what is happening: My custom template code: https:...
0
votes
1answer
32 views

The post content just showing up text

I am newbie in wordpress. I can't fixed it and I really wonder that. I get the content with "the_content()" function. But if I add the picture, just write the attr (alt) of image or when I use link, I ...
1
vote
1answer
2k views

Replace post's “the_content” with ACF value

I try to replace post's the_content with value from ACF field article_text. I managed to achieve it with following method: $postid = get_queried_object_id(); $my_post = array( 'ID' ...
0
votes
2answers
63 views

Custom signature appears twice on page

I have a simple plugin which adds a signature at the end of each post. But it also appears after user comment section. How to avoid the latter? Update I have tried to run the function once by adding ...
1
vote
0answers
262 views

Add Attribute to p Tag of Post Content

I would like the default <p> elements that are added to the (TinyMCE) editor when users post content, to have a dir attribute as well. Reasoning: When the editor is displayed to users, it is ...
0
votes
1answer
107 views

Only first shortcode gets executed

I am trying to get 2 shortcodes (single-include and single-factsheet) on one page. The Problem is, that only the first shortcode is getting executed. The second shortcode on a page simple returns the ...
0
votes
1answer
175 views

pre_get_comments or the_content filter

What is the best practice to show social icons always on all the posts and pages. Already I am firing pre_get_comments in my functions.php to show a sidebar between the post content and the comments....
3
votes
1answer
1k views

the_content and wp_link_pages

Many plugins seem to be adding a filter/action hook to the_content to display related posts, advertisements and such. The problem is I these appear before the post pagination so it the pagination is ...
0
votes
1answer
3k views

removing <p> tags around img, iframes and also scripts

I've been working with embeded content and as many already know, wordpress wraps the_content() lines in p tags. So, found this: $content = preg_replace('/<p>\s*(<img .* \/>)\s*(<\/a&...
0
votes
1answer
18 views

Searching for themes that post full article on home page by default

I understand there is way to change the_excerpt to the_content. But do any of the existing "features" on the search feature (under add new themes) indicates the the_content is already the default ...
1
vote
1answer
981 views

Visual Composer integration [closed]

I've installed Visual Composer on my own template. The thing is that is not rendering all it's shortcodes. <?php $post = get_post( $post->ID ); echo $post->post_content; ?> Is that code ...
-1
votes
2answers
55 views

echo statement repeats

Creating first wp plugin. Using add action init with filter for the_content I noticed that whenever I echo anything it appears twice in the header, and finally once in the body. Why? Or How can I ...
0
votes
1answer
4k views

Dynamic bootstrap tabs with post_title doesn't display the_content

Im trying to use bootstrap tabs to have a tab system following: Each tab has the_title (post title), on click of each tab, display the content. So far, I have all the tab listed correctly, and the ...
11
votes
1answer
2k 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 ...
0
votes
1answer
1k views

Insert Content Before div#main from the functions.php File

I know WordPress has a filter for targeting the content in the functions.php file: add_filter( 'the_content') However, is there a filter to insert content BEFORE ? 'the_content' filter puts content ...
2
votes
2answers
2k views

Getting a div content of a post in wordpress?

How can I fetch a div content from a post? Using the_content() can fetch all the data but instead of that, I need specific content from the div only. So far, all I could do was get the link of the ...
0
votes
1answer
1k views

How can i specify the size of the image rendered by the_content();?

I can do it manually like this: echo get_the_post_thumbnail($post->ID, 'large'); But how can i set the size of the image rendered by the_content(); to Large too ?
0
votes
1answer
39 views

Why is this array not working?

So first I am trying to get all pictures from content to take first picture from content and set it as features image if such is not set. I found part of thi online, it seems that this makes loop ...
0
votes
1answer
4k views

Cannot retieve the_content() and the_author() - both returning empty strings

I am creating the following code to display open graph meta data in the header of my single.php page add_action('wp_head', 'mycode_add_og_meta_tags', 5); function mycode_add_og_meta_tags () { ?> ...
0
votes
2answers
233 views

Single.php the_excerpt loads same as the_content not loading read more line

Currently I'm using the the_excerpt on my frontpage which works perfectly. When the visiter goes to the post it first needs to read the first part of the story, see a featured image and then load the ...
1
vote
2answers
2k 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
1k 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 ...