Questions tagged [post-content]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
1answer
711 views

add css to only body text

In my single wordpress posts I want to apply a padding of 100px to the left and right. The problem is that when I apply it to .single .post-content the images also get a padding. However, I want all ...
1
vote
1answer
2k views

Exclude posts with empty post_content in wp_query

is it possible to exclude posts with empty post content from a wp_query? $args = array( 'post_type' => array('post'), 'posts_per_page' => 5, 'post_status' => 'publish', ); $...
0
votes
1answer
734 views

post_content is stripping HTML when adding a new post? [closed]

I have the following in my functions.php file: $post_content = " Image: <img src='$featured_image' /> Address: $event_address Zip: $event_zip Region: $event_region Country: $date_country ...
1
vote
1answer
98 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 ...
-1
votes
3answers
7k views

displaying content of custom post type

I have a following code for the custom post type, and I want to display the content of it inside the loop. $args = array( 'post_type' => 'gallery', 'posts_per_page' ...
0
votes
1answer
71 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 ...
0
votes
1answer
94 views

SQL trigger failes with post_content

Let me tell you my story... I was having an issue with  char visible within the post's content. Instead of editing each one, I was passing a simple query: UPDATE wp_posts SET post_content = REPLACE( ...
1
vote
1answer
290 views

Bulk updates to post_content

Ok, so I have a custom post type (let's call it 'custompost') with about 3,000 posts and each has about 150 advanced custom field data items. I am trying to update the post_content for all of these by ...
1
vote
0answers
358 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 ...
6
votes
1answer
2k views

Is there a quick way to remove inline css from all posts?

I have 40 WordPress sites with 20-30 pages on each. Most of them have some inline css, like <p style="text-align: justify;"> in every single paragraph. Is there a quick, mostly automated way to ...
0
votes
1answer
342 views

Query posts only with actual text content (not including shortcode or images)

I'm trying to display a set of posts with the thumbnail, title, and content/excerpt. I don't want to show posts that don't have content or a thumbnail for display/formatting purposes since this is ...
9
votes
1answer
426 views

Why is javascript allowed in my post content?

The codex says you can't add javascript in the post content https://codex.wordpress.org/Using_Javascript But I can. I've turned off all plugins and changed to twentysixteen theme, but to no avail - ...
0
votes
2answers
75 views

How to filter url on post submission?

I would like to swap out image URLs upon post submission on both content editor field and a custom field cover_image of a custom post type article. For example, the original content may contain image ...
1
vote
1answer
617 views

Is there a way to show only the text editor

I'm working on a desktop app and I'd like to show only the editor and it's toolbar. I'm able to load and save the past content easily enough through the app but I'd like to be able to reuse the ...
6
votes
2answers
800 views

Insert Custom HTML After Shortcode

The scenario is that I need to add an HTML banner under a slideshow which is a shortcode in the homepage content. I personally hate adding a bunch of div tags to the TinyMCE editor so I'm trying to ...
1
vote
2answers
421 views

Password protection for page template

I`m using my own page template, for display post from some category: $wp_query = new WP_Query(); $wp_query->query('&cat=9' . '&paged=' . $paged); while ($wp_query->have_posts()) : ...
1
vote
1answer
137 views

Add predefined/default values to custom post plugin

I have created a custom post plugin. I need to add predefined text/values within this plugin, when adding new custom post. Is it possible to handle these predefined text/values in my plugin PHP file,...
-1
votes
2answers
127 views

How to show NEW post content in post editor?

In my functions.php I have: global $wpdb; $wpdb->update( $wpdb->posts, array('post_content' => $newcontent), array('ID' => $post_id) ); this code updates the post_content ...
-1
votes
1answer
322 views

Get the excerpt of post_content

Hi guys can you explain me how to get a excerpt length of 15 for the post_content in my code: <?php $args = array( 'numberposts' => '2', 'tax_query' => array( array( '...
0
votes
1answer
1k 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 ...
1
vote
2answers
2k views

How to parse shortcodes within returned content

I'm using Visual Composer, but I think it has more to do with WordPress than VC ;-) I did a shortcode (with the VC API) to get the content of a post. Here it is (in functions.php): add_filter( '...
1
vote
1answer
4k views

How to display widgets inside a page content without a plugin?

I want to build a homepage where I can show posts gathered from different categories and having the ability to choose such categories from the admin. I was thinking to use widgets for this. Is the ...
0
votes
1answer
492 views

Formatting post content to exclude gallery

I have this code which takes the first gallery for a post's content, and formats it with more code preparing it for slideshow usage with css and js. $gallery = get_post_gallery_images( $post ); $...
0
votes
1answer
278 views

Show only picture from post_content in custom RSS file

I need to do custom RSS file, And i need to show only pictuer from post_content and put it in <img> tag and remove any word, from post_content . So how can i display only images from ...
0
votes
1answer
30 views

Removing Images from a WordPress Post

I wanted to remove the images from a WordPress post to give me more control of how I could layout the design for the front page of a website. After doing some messing around and failing, I finally ...
1
vote
1answer
91 views

Getting post content without the navigation

I'm having a issue I don't seem to be able to figure out how to get around. I'm using the_content(); to get post content for a single post, but it returns a navigation item with it. I would like to ...
3
votes
2answers
164 views

Is it possible to handle a specific section of a post separately?

I've tinkered with WordPress a little, but I'm far from an expert, so apologies in advance if this is a duplicate question. I've built a simple WordPress theme based around Bootstrap, and I can ...
0
votes
1answer
407 views

wp_mail sending old content from post

I have a function that sends out emails using wp_mail() every time a post is published or updated. However, the content that is being sent is always one post behind. If I update the content the email ...
2
votes
1answer
1k views

Search and replace in post content

I am about to change themes on my site and also a plugin that creates tabs with a post. I need to replace multi-line text with other multi-line text and can't work out how to do it. I have tried "/r/...
22
votes
3answers
49k views

How to get 'post_content' without stripping <p> tags?

I'm trying to retrieve the post content of a specific post: $post = get_post(/* id */); $content = $post->post_content; However, this retrieves the content with no line-breaks and omits all <p&...
0
votes
0answers
44 views

Inline Ajax call after term is appended with a @ or # etc. displayed in div

Basically what I would like to know is how to do the following: I have TinyMCE Advanced enabled. I would like for my users to be able to tag content with different special characters (each refer to a ...
0
votes
1answer
31 views

Post content is cleared when updating

When I'm updating a post, its content is being cleared. What's wrong with the code below? add_action( 'save_post', 'eb_save_subpage_data' ); function eb_save_subpage_data() { global $post; ...
0
votes
1answer
87 views

If statement to check for post_content

I'm trying to write an if statement to check for post_content and if there is no post_content then to grab a textarea field content. Below is my code and with this, at this point it's only rendering "...
-1
votes
1answer
4k views

Display post's description and caption

I am trying to get and display 5 featured posts. To achieve this target I have an offset of 5 recent posts. I have successfully fetched the posts' id's and images, but I failed to get every post's ...
1
vote
1answer
2k views

wp_insert_post -> post_content not showing

I have a problem with wp_insert_post. When I'm attempting to insert my post, the post_content essentially shows up as just blanks spaces. I even went into MySQL to confirm. Everything else, ...
0
votes
1answer
91 views

Checking post content for a shortcode, but content is being returned as empty

Alright so I am trying to check for a shortcode in the post content so that I can enqueue scripts as necessary. I have this: if( plugin_has_shortcode() ) { // Load CSS ...
2
votes
1answer
636 views

Get IDs of posts currently visible on archive

This probably is a easy one for many. And also probably is already answered here, but I don't know how to search for it - so sorry I did search but not found anything. I like to get the contents of ...
0
votes
1answer
1k views

How to get post content from an array of ids?

How do I get post content if I have an array of id's. Basically, I have a function that get post content if you provide an ID. but it doesn't work if I have an array of id's. My function is: function ...
0
votes
1answer
156 views

Custom content before post content

I am using this code to insert custom content after title and before content. How can i limit it to only "post" not pages and custom post types. function theme_slug_filter_the_content( $content ) { $...
0
votes
1answer
2k views

post_content is empty

I'm trying to make some plugin. This plugin is some kind of auto posting. function new_post($title,$content) { $post = get_post($id); $feat_image = wp_get_attachment_url( get_post_thumbnail_id($post-&...
9
votes
1answer
16k views

post_content with line breaks

I want to be able to get post_content with line breaks. What is the best way to do it? I previously use the_content() which was working fine until I needed to install a plugin that adds share buttons ...
0
votes
3answers
1k views

Conditionally set post_content in wp_insert_post

Is it possible to conditionally set the post_content in wp_insert_post? Im using a foreach to add multiple pages at once: foreach ($create_pages as $new_page) { $add_pages = array( '...
0
votes
1answer
479 views

form to post multiple inputs into post_content

I have a form, with multiple inputs that I am trying to get posted to the wordpress "post_content". I am able to get the title field and only one other field to post successfully, only when making a ...
0
votes
0answers
284 views

Add class to all parent elements inside the_content

Is there a way to add a class to all parent elements inside the_content? My problem is I'm using this kind of css selector: .post_content>* {margin-bottom:10px;} This is to due with mostly ...
0
votes
1answer
3k views

Content area is too small

I want to change to the new twenty fourteen theme because it's a nice look and feel. However if I try so the content is reduced only on a small area and a lot of space on the page is unused. I ...
0
votes
1answer
2k views

How to add content at the end of posts?

I am trying to add custom fields at the end of posts. I succeeded showing the custom content using the below mentioned code. But the main post's content was replaced. : function ...
2
votes
3answers
917 views

How to *disable* the post content editor

Any good ideas on how to disable the post content editor? I don't want to hide it, remove it, or remove the page. The goal is to allow users with few permissions to view the edit screen so they can ...
0
votes
1answer
157 views

Add custom content to nonexistent page

I am trying to add content to what would otherwise be a 404 page. For example I want to define post content for mysite.com/existing-page/imaginary-page instead of showing the 404 page. I've tried ...
1
vote
1answer
2k views

Creating a post from data returned from HTML form

I am trying to write a WordPress plugin and I have hit a bump. The Background: I have some data in a mySQL DB that I am using (each row has a unique ID and some other information I have added). I am ...
0
votes
1answer
188 views

Copy url from post_content to custom field

I'm new to MySQL so I don't know if this is even possible. I would like to copy a url that's in post_content to a custom field. The url is variable and it looks like this: [audio:http://www.website....