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
22 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 ...
user avatar
0 votes
1 answer
71 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', ...
user avatar
0 votes
0 answers
38 views

Replace the_content with ACF Flexible Content via function

function replace_the_content($content) { global $post; // ACF post summary if (get_field('post_summary')) : $post_summary = '<h4> ' . get_field('post_summary') . '</h4>';...
user avatar
0 votes
0 answers
15 views

How to stop DOMDocument destroying embeds?

I am making use of PHP's DOMDocument to carry out two DOM operations on the post content, by filtering the_content: Wrap a certain element pattern in a div. Add a class to a particular element. The ...
user avatar
0 votes
2 answers
56 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 ...
user avatar
0 votes
0 answers
14 views

why my urdu text is not aligned properly when written in wordpress blog post?

I was trying to write a blog post in urdu but the text got disorganized in the front end and also sentences were disorganized giving no meaning. I have installed a plugin for urdu font thinking that ...
user avatar
0 votes
1 answer
21 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 ...
user avatar
0 votes
0 answers
71 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 ...
user avatar
  • 1
0 votes
0 answers
18 views

Scanning for custom embed and prefetching

I have an embed which is essentially a script and a div (so not an oembed) which can easily be added via the html block. I'd like to be able to slip a prefetch link conditionally into the head when ...
user avatar
  • 472
0 votes
0 answers
93 views

How to exclude native lazy loading from first image in post content?

I have been using wp rocket and a few other plugins to lazy load and finally thing we can get off of it and use native lazy loading. The first image in my niche often displays above the fold for both ...
user avatar
1 vote
2 answers
22 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 ...
user avatar
0 votes
2 answers
16 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>...
user avatar
  • 308
0 votes
1 answer
30 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+</...
user avatar
0 votes
0 answers
30 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, ...
user avatar
0 votes
1 answer
144 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 ); ...
user avatar
  • 1
0 votes
1 answer
38 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 ...
user avatar
0 votes
1 answer
237 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 ...
user avatar
0 votes
1 answer
242 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 ...
user avatar
1 vote
1 answer
164 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 ...
user avatar
0 votes
1 answer
72 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 ...
user avatar
0 votes
1 answer
34 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( ...
user avatar
  • 15
0 votes
0 answers
134 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....
user avatar
0 votes
1 answer
47 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 --> ...
user avatar
  • 1,913
2 votes
3 answers
176 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 ...
user avatar
0 votes
0 answers
135 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 ...
user avatar
  • 1
0 votes
1 answer
18 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 ...
user avatar
  • 121
0 votes
1 answer
24 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 ...
user avatar
  • 113
1 vote
0 answers
25 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( $...
user avatar
  • 11
0 votes
1 answer
56 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 ...
user avatar
0 votes
1 answer
30 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...
user avatar
  • 115
2 votes
1 answer
683 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 ...
user avatar
  • 131
0 votes
1 answer
91 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 ...
user avatar
  • 13
0 votes
1 answer
104 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 ...
user avatar
  • 101
0 votes
1 answer
72 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(); ?&...
user avatar
1 vote
0 answers
83 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 ...
user avatar
0 votes
1 answer
131 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
user avatar
1 vote
1 answer
239 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 ...
user avatar
1 vote
1 answer
34 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. ...
user avatar
0 votes
1 answer
25 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
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 ...
user avatar
0 votes
2 answers
46 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 ...
user avatar
0 votes
2 answers
206 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 ...
user avatar
0 votes
1 answer
383 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 ...
user avatar
-1 votes
1 answer
104 views

How to add custom HTML markup and classes to the_content()?

I have HTML template for output from the_content() function. It contains elements with custom classes such as <blockquote>, headings or paragraphs. <p class="mb-40">Nemo enim ipsam ...
user avatar
  • 144
0 votes
1 answer
125 views

the_content() not showing the content in good order (with a shortcode)

I've added a shortcode [form] inside my wysiwyg the 2 paragraphes before the shortcode. <p>test 1</p> <p>test2</p> [form] but on the frontend, the shortcode is showing at ...
user avatar
1 vote
0 answers
101 views

Force Balance Tags not working

I am trying to shorten my the_content() word count to 200 while retaining the html formatting as well as the shortcodes. I am pretty close but for some reason, I cannot get force balance tags or ...
user avatar
  • 19
0 votes
0 answers
26 views

how can i take wordpress post as embed?

how can i get an adress for using iframe in another website? Example: site.com/sample-page i will use this page in another website as iframe but only content part Example: <iframe src="site....
user avatar
0 votes
1 answer
42 views

does wp function the_content(); accept another tag inside

I want to place some other PHP tag inside the_content() is it possible somehow? <?php the_content( $custom_attach = get_post_meta( $post->ID, 'wp_custom_attachment', true ); $...
user avatar
  • 171
0 votes
1 answer
418 views

the_content() not displaying the full post

When I use the_content() in the template php file, it displays the_excerpt() instead of the full post content. I tried removing all filters with remove_all_filters('the_content'); But it still ...
user avatar
1 vote
0 answers
27 views

How can I add class to every quote element?

How can I edit defualt class of quote element? Can I use some kind of hook in the_content to add class to any other element??
user avatar
  • 21

1
2 3 4 5
11