How to display recent posts on home page with title, post date, author and featured image?

The functions you are looking for, are: the_post_thumbnail_url(); // For featured image the_author(); // For author name get_author_posts_url(); // For author link the_date(); // For post’s date So, your code should be something like this: <div class=”cs-post-carousel-layout”> <div class=”cs-container swiper-container”> <div class=”swiper-wrapper”><?php // define query arguments $args = array( ‘posts_per_page’ => 5, // your ‘x’ … Read more

How to filter homepage posts by popularity? [closed]

First thing we need to do is create a function that will detect post views count and store it as a custom field for each post. To do this, paste the following codes in your theme’s functions.php file function wpb_set_post_views($postID) { $count_key = ‘wpb_post_views_count’; $count = get_post_meta($postID, $count_key, true); if($count==”){ $count = 0; delete_post_meta($postID, $count_key); … Read more

What is the advantage of using home.php over index.php for the front page

If you look here [is_home vs is_front_page] you’ll see that is_front_page() is true regardless of what the homepage is set to in the WordPress settings. This means that if you don’t plan on releasing this publicly (i.e. short-run usage) then just having a front-page.php should suffice. is_home() is set based on your blogs page (which … Read more

How to replace text in hompage only

the_content(Read more …’) echoes the stuff straight out so you can’t modify it with str_replace after the fact. If you wanna use str_replace you need to do something along the lines of $content = get_the_content( ‘Read more …’ ); $content = apply_filters( ‘the_content’, $content ); $content = str_replace( ‘]]>’, ‘]]&gt;’, $content ); $content = str_replace( … Read more

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