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
1
vote
2answers
16 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 ...
0
votes
2answers
15 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>...
0
votes
1answer
18 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+</...
0
votes
0answers
22 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, ...
0
votes
1answer
34 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 ); ...
0
votes
1answer
26 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 ...
0
votes
1answer
139 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 ...
0
votes
1answer
43 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 ...
1
vote
1answer
99 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 ...
0
votes
1answer
28 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 ...
0
votes
1answer
30 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( ...
0
votes
0answers
61 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....
0
votes
1answer
36 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 --> ...
0
votes
0answers
36 views

Please how do I make my wordpress post images show, It's showing data:image

Please how do I make my wordpress post images show, it's showing data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 making my images not to show up on my post content, but ...
2
votes
3answers
167 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 ...
0
votes
0answers
88 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 ...
0
votes
1answer
13 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 ...
0
votes
1answer
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 ...
1
vote
0answers
20 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( $...
0
votes
1answer
46 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 ...
0
votes
1answer
29 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...
2
votes
1answer
465 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 ...
0
votes
1answer
63 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 ...
0
votes
1answer
73 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 ...
0
votes
1answer
37 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(); ?&...
0
votes
0answers
65 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 ...
0
votes
1answer
102 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
1
vote
1answer
188 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 ...
1
vote
1answer
30 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. ...
0
votes
1answer
23 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
0
votes
0answers
21 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 ...
0
votes
2answers
40 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 ...
0
votes
2answers
161 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 ...
0
votes
1answer
207 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 ...
-1
votes
1answer
63 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 ...
0
votes
1answer
77 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 ...
1
vote
0answers
95 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 ...
0
votes
0answers
25 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....
0
votes
1answer
40 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 ); $...
0
votes
1answer
280 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 ...
1
vote
0answers
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??
-1
votes
2answers
97 views

Where can I find the "add_action()" inside a theme?

I'm developing a WordPress plugin for a site that is using the theme ColorMag. The plugin uses the_content() to insert some content in a page. When I put the plugin in other test site, the content is ...
0
votes
1answer
688 views

Get featured image from post on RSS feed

I want to add the featured image to my RSS feed. function rss_post_thumbnail($content) { global $post; if(has_post_thumbnail($post->ID)) { $content = '<p>' . ...
1
vote
1answer
572 views

How can I show the actual content of Posts page because the_content() is showing all blog content?

In Settings>Reading I have the following static page set Homepage: Welcome to blurr (front-page.php) Posts page: Blog Posts (home.php) I'm trying to get the_content of the Blog Posts to show ...
1
vote
0answers
400 views

Removing "wpautop" (auto <p> tags) only on certain pages?

I'm using the remove_filter in functions.php to remove the auto insertion of <p> and <br> tags on my wordpress site. remove_filter( 'the_content', 'wpautop' ); remove_filter( 'the_excerpt'...
0
votes
0answers
848 views

Auto generate excerpt from ACF field on a CPT that does not support excerpt or content

I have a CPT which contains only 4 wysiwyg fields created with ACF. The CPT does not support standard WP excerpt or content fields. I would like the CPT to generate an excerpt automatically from one ...
0
votes
0answers
256 views

Remove pre and code tags from WordPress

WordPress has added both <pre> and <code> tags to my PHP embedded in a post. Here's an example <pre><code>register_taxonomy( 'Books', 'post', array( 'label' =&gt; __(...
0
votes
1answer
114 views

Highly stylized pages

I'm building my own WP site, with its theme from scratch, and I need 2 very customized pages, including the front page. To give you an idea, a bit like this. (mine will be more simple though) That ...
0
votes
1answer
218 views

Omit image captions from get_the_content()

I use a theme that calls get_the_content() to display short excerpts of the latest blog posts on the home page. Now I noticed that the excerpt sometimes starts with an image caption, if the blog post ...
0
votes
1answer
2k views

How to get different html tags from the content using regex?

I am trying to get different html tags from a single post and display them as nested accordion. I have quite accomplished. the only problem I have is that. When I try to show all the p tags content ...

1
2 3 4 5
11