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

learn more… | top users | synonyms

-1
votes
0answers
26 views

How to get posts without content from server

<section class="no-padding" id="portfolio"> <div class="container-fluid"> <div class="row no-gutter"> <?php $recentPosts = new WP_Query(); ...
4
votes
0answers
54 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
21 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 ...
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 ...
1
vote
0answers
22 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) ...
0
votes
1answer
494 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 ...
0
votes
2answers
429 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 ...
1
vote
1answer
20 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
18 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
100 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
29 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
53 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 ...
2
votes
3answers
156 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 ...
7
votes
3answers
982 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
52 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
53 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
15 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
19 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
88 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, ...
5
votes
2answers
5k 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 ...
1
vote
1answer
41 views

Modify Image Source With The_Content Filter?

I'm very inexperienced with regex, however I'm trying to create a function that filters through the_content() and get_the_content() in order to modify the SRC of all images. The intended purpose ...
0
votes
1answer
59 views

Add caption functionality to custom WordPress theme

Hi I am working from a custom theme created by my predecessor and I am trying to add caption functionality to the theme but I am have some trouble with it. Presently if I insert a image into a post ...
0
votes
1answer
41 views

the_content() keeps repeating itself

I'm new to Wordpress and am having trouble getting my loop to make the_content() not repeat itself. I've tried writing multiple loops as well to no avail. I mainly just want the_content() to iterate ...
1
vote
1answer
81 views

custom post type grid with content in lightbox

I'm going around every single wordpress plugin and impossible to find something with this featured . . . . I need a grid list of some custom post type - with inline filter. This is fine and tons of ...
0
votes
3answers
5k 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 ...
0
votes
1answer
30 views

How can I get the default content of WordPress post?

Is there a way where I can get the default output of the_content in WordPress post? Some of the plugin is using add_filter to the content to add their desired result like related post plugins where ...
0
votes
1answer
27 views

Filter Content on all Post Types

I had this idea to introduce a 'post type footer' using Advanced Custom Fields so that my users could set up common, reusable messages or calls to action and have them appear after the content of a ...
0
votes
0answers
48 views

How Can the_post Be Hooked Like the_content and the_excerpt?

My plugin currently hooks properly with the_content and the_excerpt, but when I try to hook the_post, I get the error "Catchable fatal error: Object of class WP_Post could not be converted to ...
0
votes
1answer
43 views

Update Plugin Without Overwriting Custom Settings

My plugin uses the code below that has uid="x" in it that requires the user to edit the plugin and set "x" to their user id, such as uid="420971". Whenever I release an update to the plugin and the ...
2
votes
1answer
70 views

How Can A Plugin Hook Itself To the End of Every Excerpt?

So far, I've been able to only consistently hook the_content, appending my plugin at the end. How can I test if the displayed article is not the_content, but an excerpt, and hook my plugin after every ...
0
votes
1answer
58 views

Strip HTML tags on custom code from the_content

I"m making a custom RSS feed and need a way to strip HTML tags from a custom code that grabs the first paragraph from a post. This is what I'm using: <?php $paragraphAfter = ...
-2
votes
1answer
39 views

Adding schema to text content in the loop, how?

Given the following code: <?php if ( has_post_thumbnail() ) { the_post_thumbnail( 'full', array( 'class'=>'post_thumbnail_common', 'alt' => get_the_title() , ...
0
votes
1answer
52 views

str_replace function in theme

I am trying to change the color to red on certain words on my site. However the below code changes each word to "array". Can someone tell me what is wrong with my code? function ...
0
votes
0answers
86 views

How to show single post from custom post type with shortcode

I know the topic have been around before, and have read extensively on the subject, without finding a complete solution. My goal is to have a shortcode that calls a single post, from my custom post ...
3
votes
2answers
627 views

Remove specific shortcode from get_the_content()

I have a variable like this: $post_content = get_the_content(); Here I want to remove some specific shortcode from the $post_content variable e.g I want to remove only this [video height="300" ...
0
votes
2answers
93 views

Showing content from one page on another

There are many posts that seem to strike around this area, but I'm more and more confused by each one I read. I have a page that shows the "Terms of Service" (id = 1086). I would like to display the ...
0
votes
0answers
50 views

Filter the_content() to add custom figure tags

I'm trying to implment responsive images on my site, and have all the required component parts working, and understand the concepts, but need some help putting them together; Knowing that WordPress ...
0
votes
1answer
106 views

Remove links from the_content when using filters wp_trim_excerpt

I'm using wp_trim_excerpt which is working perfectly but I want to strip the links contained in the the_excerpt (using get_the_content), I've looked online and tried many solutions to get the thing to ...
0
votes
0answers
37 views

When can a template skip the loop?

I've reached another point with WordPress where something simple is stumping me. In working with an older theme, I have some page templates that do not call the loop. They simply use ...
0
votes
2answers
56 views

Stripping <p> tag from elements in post

I'm fine with P tags for most of the content, since it makes styling easier. However I'd like to have span div iframe and possibly other HTML tags to not be placed inside of a p for post. I saw this ...
1
vote
1answer
242 views

Only display videos and images in the_content() within loop

The issue I am trying to solve is within the WordPress loop, I only want video embeds or images to display, not any text. Currently, when creating a new post (Standard format) in the WordPress ...
1
vote
1answer
39 views

Changing Image Size In The Content tag

I am developing a WordPress theme locally and I can't figure out how to get an image to display in a normal size in the_content(). At the moment, the images are displaying the same size as my featured ...
0
votes
0answers
42 views

Loading ajax does not run through filter the_content

I have created a quiz page with a list of question. I use ajax to load the question content into the quiz. However, only the first question which loaded directly (not through ajax) render correctly. ...
0
votes
2answers
35 views

Echo Most Recent Sticky Post in Loop?

I am looking to echo the most recent post in the loop of content. Only 1 post. Do I need to put some sort of parameter on the following code: if (have_posts()) : while (have_posts()) : ...
0
votes
2answers
39 views

Expandable WordPress content (text) inside a post

I've created a CPT in my WordPress site. In this CPT I have the content element (which is the default WP content) and want to make it expandable, I mean, while viewing the CPT I want it to only ...
0
votes
2answers
75 views

Problem in exploding the_content to array

I've written a code in a WP_Query to converting a string (the_content) to an array (choices). But it seems wrong! In fact, the choices array is empty after each loop. However str string is notnull. ...
0
votes
1answer
36 views

changing size image within the content

I'm trying to get my images inside the post may larger than 800px ; For this I took a function that resizes image here and I'm trying to create a function to my thumb inside the post come with size ...
0
votes
1answer
88 views

How can I extract the URL of a link from a post?

I am pretty new in WordPress and I have the following doubt. I have a page that take some informations from a list of post that belong to a specific category and show these informations into ...
0
votes
1answer
43 views

Put teaser content, more-link and full content in different divs if existing… Possible?

im working on a flip-card template and have a problem. <div class="card" id="card-<?php the_ID(); ?>"> <div class="front"> <div class="card-headline"><?php ...