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
1 answer
11 views

Read page- or post-content across different builder-plugins

I am currently working on a WordPress-plugin to analyse post- and page-content. The plugin contains a php-function that read the post- and page-content across several different builder-plugins (such ...
Dennis's user avatar
  • 103
0 votes
0 answers
20 views

Why does the_content filter output var_dump, print_r or echo surrounded by quotes?

I'd like to alter the images for a particular page using the_content filter. When debugging or testing elements of the code, I've noticed that the output is surrounded by quotes. For example, print_r( ...
Motivated's user avatar
  • 205
0 votes
1 answer
19 views

Wp private content show me files attachments into post

I'm using that plugin wp private content and it works fine, but (probably for a update) that show me at the final part of the post a box with link to download someting...in each post! Even if the post ...
Marcos's user avatar
  • 187
0 votes
0 answers
28 views

Modify 'the_content' appearance in the admin area

In the backend admin area, is it possible to change 'the_content' section to appear as a basic text input similar to 'the_title'? So turning it into a simple text input, instead of the rich text ...
Andy's user avatar
  • 215
0 votes
1 answer
97 views

Some CSS classes missing when rendering the page with get_the_content()

I am using get_the_content() to load other pages content on the current page, and I noticed some block CSS classes are missing in the HTML I get. For example, is-layout-flex layout CSS class is ...
Tahi Reu's user avatar
  • 206
1 vote
1 answer
17 views

Limit total tags in the_content

I am using the_content to display content in a custom theme, but I am running into an issue. Right now, I have some JS code that removes the <br> tags and replaces them with </p><p> ...
Josh Rodgers's user avatar
  • 1,143
4 votes
1 answer
169 views

Return the_content() with custom div class for a subset of posts

Is it possible to have the_content() function return the post content in a div with a custom CSS class (i.e. something other than the-content)? I have a unique post I'm trying to lay out that requires ...
Geoff's user avatar
  • 41
0 votes
0 answers
21 views

WP: Override/update the_content from database with the publicly echo the_content

I have many hooks that apply to the_content (post content) so I want to override the database with that final version of the_content (the one that loads publicly to the user), so I get rid of all the ...
david-2021-learning's user avatar
0 votes
0 answers
27 views

Nested ShortCode works inside the_content, but not outside of it

community; I've spent all weekend trying to crack a problem that so far eludes me. On a multisite implementation, I'm using a simple homegrown plugin to include textbits that are the same across ...
eLeXeM's user avatar
  • 3
0 votes
0 answers
13 views

Hide old posts each year

I've had an interesting enquiry from a client site we built (using Extra theme from Elegant Themes) and manage for a school. Each early September, when the school starts a new academic year, they ...
Dozza's user avatar
  • 41
0 votes
0 answers
78 views

Using str_replace on the_content and the_excerpt, but not working on archive index pages

I am using code like this to replace a string in my posts. function replace_text($text) { $text = str_replace('look-for-this-string', 'replace-with-this-string', $text); $text = str_replace('look-for-...
McFarnell's user avatar
1 vote
0 answers
41 views

Add Content Column to Custom Post Type backend

I have a basic custom post type: function create_posttype() { register_post_type('guestbook', array( 'labels' => array( 'name' => __('Guestbook Entries'), ...
Josh Rodgers's user avatar
  • 1,143
0 votes
1 answer
62 views

Post and page content not displaying in search results

I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is ...
Mike Hermary's user avatar
-1 votes
1 answer
107 views

Filter post style attribute

Looking for a hook which enables filtering of a class within the post or content so i can add inline CSS using custom fields for posts on the home page. Something like this - add_filter( 'attr_entry', ...
Brad Dalton's user avatar
  • 6,886
0 votes
2 answers
744 views

Filter content for get_the_content()

I Need to filter content for posts. If the user is not logged in, then the post content should display "please log in....". If he is logged in, then he can see the post content. I wrote the ...
Czechu92's user avatar
0 votes
1 answer
29 views

Add hook after content without formatting

I want to add a table after the_content with a hook, but it's adding <p> tags in certain areas. This is a plugin, I don't want to remove <p> tags from all the_content, just the table I'm ...
Justin Breen's user avatar
0 votes
1 answer
537 views

How do I display main query posts in random order using add_filter

So I tried two methods to simply display the main query posts in random order - simple. I'm also trying to understand all this better. Using the_content add_filter, with my own instance of WP_Query ...
Mario's user avatar
  • 1
1 vote
2 answers
122 views

Adding to the_content or a variable from within a shortcode function

I've created a custom shortcode to add pop-up definitions to selected vocabulary terms. The shortcode looks like this: [glossary term="data breach"]data breaches[/glossary] The function ...
BoyKenan's user avatar
0 votes
2 answers
17 views

How to debug this search & replace strings snippet?

I add this code (modify from this comment) into my plugin: function wpdocs_replace_content( $text_content ) { if ( is_page() ) { $text = array( 'chamber' => '<strong>...
Ooker's user avatar
  • 330
0 votes
1 answer
90 views

How to Create custom block for displaying information in content section which act like shortcode

I wanted to Display one block which act like shortcode in front and plugin in background. For Example <div class="one-fourth fl glousp-box"> <p class="figure">5000+</...
Bhargav Joshi's user avatar
0 votes
0 answers
94 views

Give ID to divs inside the loop

I'm trying to make this code work on my WordPress site: https://codepen.io/eksch/pen/xwdOeK It is a simple code so that each menu item receives the active class when the user scrolls through the page, ...
Eduardo Reis's user avatar
0 votes
1 answer
339 views

How to remove image size inline style in article and include caption

I am using the following filter to remove the inline style in the image tag when used in the content editor of the ACF text field: add_filter( 'post_thumbnail_html', 'remove_width_attribute', 10 ); ...
Andrew's user avatar
  • 1
0 votes
1 answer
136 views

the_content getting current page content instead specified ID

I'm using below code to call the_content of a custom post type post, but when I'm run it, it always getting the current page content not the page whose ID specified. It literally duplicate my page ...
Ajay Malik's user avatar
0 votes
1 answer
546 views

How do I remove the title from the_content

I have this code that I use to get the posts that are in a certain category. The problem is the function the_content() returns the title of the page at the top of the rest of the content. Is there a ...
PeggyMe's user avatar
0 votes
1 answer
1k views

Get specific Blocks from Post

I'm trying to load individual Post Blocks (by type) into separate divs, I've tried filtering tags but the outcome is there's a bunch of abandoned divs and it's overall messy and unpredictable. I was ...
LinguiniCoder's user avatar
1 vote
1 answer
454 views

the_content filter - checking the post

I wanted to use the_content filter to check the post categories. If a post has certain categories selected, depending on the user I want to return a message saying something like 'Sorry, you cannot ...
StripyTiger's user avatar
0 votes
1 answer
309 views

the_content() printing site title after page/post title and before its content

My pages are all showing the Site Title (from the Customizer) after the page or post title and before the "body" of the post. Troubleshooting by injecting lines of text to print before and ...
Rickmakeitquick's user avatar
0 votes
1 answer
51 views

Creating post template for a Custom Post Type

I have a custom post type called 'abstract' which contains the following meta_input array items $abstract_details = array( 'post_title' => $result->title, meta_input' => array( ...
UgKnu's user avatar
  • 15
0 votes
0 answers
456 views

Is there a way to get rendered html content of a WP post after updating?

I tried adding a filter at the content etc but that one just gives access to content stored in wp_posts. I am interested in getting the rendered html with meta tags etc for a post, after it is updated....
chatnoir's user avatar
0 votes
1 answer
83 views

Add function after the_content

I have the following function within a simple plugin: <?php /** * Social buttons */ function zss_social_buttons() { ?> <div class="zss"> <!-- Facebook --> ...
Sam's user avatar
  • 2,106
2 votes
3 answers
197 views

Go to / Scroll to Password Field on WordPress Posts After Submit With Message(s)

I have, based on post category, added a password form (shortcode) whereof the purpose is to hide certain HTML code. To do this, I have wrapped certain HTML-tags in a shortcode using the the_content ...
Harold Aldersen's user avatar
0 votes
0 answers
267 views

get_post() with filters applied

*** PLEASE SEE UPDATE BELOW AS THIS QUESTION IS EVOLVING *** Is it possible to call get_post() and have the filters applied for the ID passed to the get_post() function? My client has asked if we can ...
Mark19's user avatar
  • 1
0 votes
1 answer
28 views

Print different parts of content in template

Is it possible to print different parts of content in template? Without ACF? For example: print the first part of text, then the gallery, then the second part of text etc. This in order to be able to ...
Hgfdsoiu's user avatar
  • 121
0 votes
1 answer
25 views

Is there a difference in usage of the_title() and the_content()

I try to learn some basics about WP so I pasted the following code into a WP page where I use a plug-in that allows me to write PHP. It works for the_title (twice), but when I put the_content ...
cvr's user avatar
  • 113
1 vote
0 answers
35 views

show content of a page built using yootheme builder on different page/template

I have a WordPress page built using Yootheme builder. I want to show the content of that page on woocommerce Category page. namespace YOOtheme; global $post; $post = get_post(2434); setup_postdata( $...
Div's user avatar
  • 11
0 votes
1 answer
100 views

How to get title of images in post content

Today I have the function created below using regex that inserts the POST title if the ALT attribute of the image inserted in the content is empty. But now I want to get the title of the image and not ...
Renan Bessa's user avatar
0 votes
1 answer
40 views

how to display sidebar on pages in wordpress

I want to display custom field's content in the sidebar on specific pages in WordPress so can anyone have an idea about it then please share it with me. Thanks In Advance...
Deep Shah's user avatar
  • 115
2 votes
1 answer
2k views

How to get excerpt correctly formatted

I'm using a theme that use the_excerpt() function to show the excerpt of the post. All posts have not set custom excerpt, so the_excerpt() returns a piece of post content. In some post first paragraph ...
Lety's user avatar
  • 131
0 votes
1 answer
148 views

Insert content above an embedded video inside Wordress' php the_content

I'm a long time beginner in Wordpress theming (i do bits here and there for myself) and have a question. I run a very large website and i'm trying to redesign it (responsive etc) and have run into a ...
Jason's user avatar
  • 13
0 votes
1 answer
270 views

How to limit wordpress the_excerpt() dynamically

I'm trying to limit WordPress post excerpt and I've tried some ways to do it but all of them was not the stuff that I need, to say concisely I want to limit post excerpt with a number that I use ...
irgfx's user avatar
  • 101
0 votes
1 answer
310 views

Getting post URL within custom content template

This should be such an easy thing but it's giving me so much headache. I created a content template called content-sticky.php. Added all the code there <article id="post-<?php the_ID(); ?&...
user3170899's user avatar
1 vote
0 answers
138 views

Filter on the_content doesn't update the content being searched via register_rest_route

I'm trying to get my custom REST route to include search results from a filtered the_content. I'm trying to automatically include the post tag names within each post's content, so that searching can ...
David Merritt's user avatar
0 votes
1 answer
186 views

How To Watermark Audio

Does anyone know a way or plugin that will help me to automatically watermark any audio uploaded in the wordpress media library
Cinnia Entertainment's user avatar
1 vote
1 answer
590 views

Styling text and images in the_content()

So I have recently started working on Wordpress and coming from a different programming background, having the logic but not being able to actually code is an issue I have been butting my head on for ...
Anuj Kaithwas's user avatar
1 vote
1 answer
36 views

Uppercase first sentence in every post

Brand new to this community but been tinkering with WordPress for years. I would like to edit my website's functions.php file to be able to automatically do a task I have to do manually each day. ...
radioman10's user avatar
0 votes
1 answer
27 views

How to show Social share buttons outside the post?

i am getting social share button inside of every post but i need ouside of every post For reference please find the attached image. i need like this
somutesting's user avatar
0 votes
0 answers
22 views

WordPress v5.4.2 escapes the content of Edit Attachment > Description field

I updated WordPress to v5.4.2 and now the content on the screen Edit Attachment, field Description is being HTML escaped so I cannot use HTML in this field. The problem seems to be caused by this line ...
Rafael Cardero's user avatar
0 votes
2 answers
224 views

Assign custom class to post content images

Is possible to assign a default class to the images that are part of a post content? I have a problem with teh layout, this because the attached images insetred inside a post will break my bootstrap ...
wpnewbie's user avatar
0 votes
2 answers
432 views

has_excerpt() not working inside wp_query

I am trying to check for an excerpt and if it doesn't exist then show the content but trimmed. Currently nothing is showing. <?php if (has_excerpt() ): ?> <p><?php echo ...
Iggy's Pop's user avatar
0 votes
1 answer
862 views

Add a div of content within the_content after a certain block

In gutenberg I have several blocks: paragraph heading paragraph code paragraph In php I'd like to find the code block and append content after the block. I'd imagine I need to use add_filter and ...
teamcrisis's user avatar

1
2 3 4 5
12