Are content.php and content-single.php the same?

No, content.php and content-single.php are not the same thing. In your example CODE: if (get_post_format() == false) { get_template_part(‘content’, ‘single’); } else { get_template_part(‘content’, get_post_format()); } WordPress will load content-single.php when get_post_format() is false. However, get_template_part( $slug, $name ) may still try to load content.php when you call it with get_template_part(‘content’, get_post_format()); in the following … Read more

why doesn’t the_content() work in this {single-custom_post_type.php} page?

Some post-related data is not available to get_posts by default, such as post content through the_content(), or the numeric ID. This is resolved by calling an internal function setup_postdata(), with the $post array as its argument: <?php $args = array( ‘posts_per_page’ => 3 ); $lastposts = get_posts( $args ); foreach ( $lastposts as $post ) … Read more

WordPress Internal @ Mentions

This is a little tricky because sanitize_user allows spaces in usernames, meaning it difficult to avoid grabbing the whole phrase ‘@johndoe said that … ‘ as opposed to just the actual username ‘@johndoe’ and you have no separator at the end that would help. To avoid that I imposed a requirement that spaces in the … Read more

post_content with line breaks

I believe this should work: $getPost = get_the_content(); $postwithbreaks = wpautop( $getPost, true/false ); echo $postwithbreaks; The second argument in wpautop can be up to you whether it’s true of false, see the link below. It is described as follows: (bool) (Optional) If set, this will convert all remaining line breaks after paragraphing. Line breaks … Read more

Only show content before more tag

You can use the WordPress function get_extended to fetch the different parts of a string (the part before and the part after the <!–more–> tag). get_extended returns an array with three keys, of which the keys main and extended are important: $arr[‘main’] contains the part before the more tag, and $arr[‘extended’] the part after the … Read more

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