Articles of the content

shortcode not working and the relation to the_content()

Reference Post (I was even downvoted here.) My short code was not working on my custom theme, but the same short code, when used in twenty fifteen, was working. I researched over google and found that it was something related to not using the_content correctly. https://kb.yoast.com/kb/shortcodes-not-rendering/ https://wordpress.org/support/topic/shortcodes-not-working-custom-theme/ I applied the solution suggested in the Yoast […]

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 know what is wrong with it. <?php add_action(‘pmxi_saved_post’, ‘post_saved’, 10, 1); $my_post = array( “ID” => $id, “post_content” => “1”, […]

Function the_content not working

I’m developing a site with the Advanced Custom Fields and SF Taxonomy Thumbnail. In any page (post type = page), I’m with an error that I don’t know what is happening: My custom template code: https://gist.github.com/gabfr/79e1c915d0b2f9ed6620aee7fdc8c8b0 (similar to the page.php) I don’t have custom filters in my function.php, and I already tried to deactivate the […]

Proper way to use get_the_content() in front-page.php and the content-home.php?

<div class=”class1″> <ul> <li> <div class=”class2″> <?php the_post_thumbnail( ‘large’) ?> </div> <div class=”class3″> <a href=””>category</a> <h2><?php the_title(); ?></h2> <p><?php echo wp_trim_words( get_the_content(), 70 ); ?> </p> </div> </li> </ul> </div> The above is an excerpt that is kept on content-home.php This is the correct version or correct coding practice → <p><?php echo wp_trim_words( get_the_content(), 70 […]

Output Buffering – Everything between wp_head and wp_print_footer_scripts?

What is the best way to use “Output Buffering” on the frontend? In my case, I need to apply some regex rules to the content generated by a theme with a page builder. So it is not possible to edit the code with the filter the_content, because there everything is still available as shortcode. But […]

$content variable – Is this a reserved variable for a WordPress function? – php / wordpress

I’m just starting to have a dig around in the WordPress codex because I’m undertaking my first simple plugin. Can I ask, is the $content variable a reserved variable for the_content() function. The actual $content variable is all over WordPress, but I can’t seem to find any information on it? When you search in the […]

WordPress get_the_content get child element like p value

I am developing web site by wordpress in case my problem I want to remove h1 and h2 tag in from main page. I want to get only child p tag by get_the_content() <p id=”main”> <?php echo wp_trim_words(get_the_content(),20, ‘…’ ); ?> </p> Main Page get the content from this page <h1 class=”entry-title”>Set and Furniture Design</h1> […]

shortcode causing the_content() to return blank?

I have a shortcode that just retrieves some info from the options table in the database. For whatever reason, when the content reaches a certain character limit the_content() to return blank? The function is pretty basic and I can’t for the life me figure out why this is happening? Here’s an example of the code: […]

Divide Post content into separate divs for every 500 characters (or any other character counts)

What is the best method for intercepting the_content of a post (for a single post page) and dividing the_content into sections of 500 characters (or any other number of characters), and then outputting each 500-character section wrapped in its own div container? I understand that get_the_content() will return the post content as a string that […]

the_content() seems to block my ACF-code

I have this simple code, but can’t get the_content and the ACF-code to work together. If I include the_content() it blocks out the ACF-code, but if I remove the_content() the ACF-code works fine. I suspect there’s a very simple solution to this. I’ve simplified and removed unnecessary elements from the code below: <?php while ( […]