Content won’t load when using action the_content

the_content is not an action, it is a filter. You should be concatenating a string and returning it. It sounds like you are echoing content directly. That is: // wrong function test_content($content) { echo ‘this is wrong’; } add_filter(‘the_content’,’test_content’); // right function test_content($content) { return ‘this is right ‘.$content; } add_filter(‘the_content’,’test_content’);

Can i use multiple ‘the_content’ filters?

You can add as many page i.d’s and conditional tags as you like. You can use the_content filter in as many functions as you like as long as they use different function names. However, when you add HTML or text content after posts, you need to use code like this: add_filter( ‘the_content’, ‘your_content_filter’ ); function … Read more

Cannot retieve the_content() and the_author() – both returning empty strings

get_the_content and the_author have to be in a loop so you would need to use other functions to get the content you need global $wp_query; $post = $wp_query->post; $page_id = $post->ID; // page ID $page_object = get_page( $page_id ); // page stuff $author_id = $post->post_author; // author ID $page_content = $page_object->post_content; $author_name = get_the_author_meta( ‘display_name’, … Read more

Only first shortcode gets executed

As indicated in the comments this code has nothing to do with shortcodes in the WordPress sense, but it is easy to see why it will never evaluate more than one pattern. preg_match returns true if there is at least one instance of the needle found in the haystack. So, no matter how many “shortcodes” … Read more

How can I display “read more” without any other post text?

You can achieve this with many ways. First thing you need to use the_excerpt() instead of the_content() and in your functions.php file you can add this function to return 0 text from post text. function custom_excerpt_length($length) { if (is_home()) { return 0; } } add_filter(‘excerpt_length’, ‘custom_excerpt_length’); This code check if this is homepage you can … Read more

How do you get specific tags from the_content?

Using preg_match_all() you can create a regex pattern to find and extract tags (and their content). With WordPress’s post_content hook, you can find and list all the H1’s within current posts content with something like: add_action(‘the_content’, function ($content){ // look for <h1> tags and text therein, anticipate class/id name $findH1s = preg_match_all(‘/<h1 ?.*>(.*)<\/h1>/i’, $content, $h1s); … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)