• Resolved yavarkhan

    (@yavarkhan)


    i would like to show 5 recent blog post in a horizontal way in the static home page ! pls help

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter yavarkhan

    (@yavarkhan)

    i want my customizr home page to show recent blog post with pictures

    rdellconsulting

    (@rdellconsulting)

    Go to Customiz’it! > Front Page
    Front Page can point to either a Static Page or your Latest Posts. So there are a few combinations that can be set (Home & Blog refer to blank Pages):
    1) Front page displays: Don’t show any posts or page
    2) Front page displays: your latest posts =Displays posts
    3) Front page displays: A static Page
    Posts page: –Select–
    Front page: –Select– =Displays posts
    4) Front page displays: A static Page
    Posts page: –Select–
    Front page: Home =Displays static page
    5) Front page displays: A static Page
    Posts page: Blog
    Front page: –Select– =Displays posts
    6) Front page displays: A static Page
    Posts page: Blog
    Front page: Home =Displays static page

    Does Option 2 work for you?

    Thread Starter yavarkhan

    (@yavarkhan)

    sir it didnt work!
    actually
    i want my post page = blog page
    Front page displays =static page
    front page = home
    and im making a eCommerce website so i want featured product on the home page and below that 5 recent blog post with pictures in a horizontal way
    waitng for ur reply

    Thread Starter yavarkhan

    (@yavarkhan)

    some 1 suggested me

    consider to create a page template based on the code of page.php of your theme https://codex.www.ads-software.com/Page_Templates and integrate a custom loop https://codex.www.ads-software.com/The_Loop where you want the posts to show, using a custom query https://codex.www.ads-software.com/Class_Reference/WP_Query

    but im new to this could u help me out

    Thread Starter yavarkhan

    (@yavarkhan)

    @rdellconsulting i made a wp_query in function.php but i would like it to display 5 recent post with thumbnails

    /*** Custom Loop ***/
    function demo_loop() {
      $args = array(
    		'cat' => 0,
    		'posts_per_page' => 2
    	);
    
    	$demo_posts = new WP_Query($args);
    
    	if ( $demo_posts->have_posts() ) {
    		while( $demo_posts->have_posts() ) {
    			$demo_posts->the_post();
    
    			$output .= '<li><a href="' . get_permalink() . '">' . get_the_title() . '</a></li>';
    		}
    	}
    
    	return $output;
    }
    
    add_shortcode( 'demo_custom_loop', 'demo_loop' );
    rdellconsulting

    (@rdellconsulting)

    Can we see a link to your site?

    Thread Starter yavarkhan

    (@yavarkhan)

    actually sir im making it in a localhost!

    Thread Starter yavarkhan

    (@yavarkhan)

    sir could u help me with a code snippet to declare it in function.php so i could show my recent blog post

    ElectricFeet

    (@electricfeet)

    Thread Starter yavarkhan

    (@yavarkhan)

    thx

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘how to show recent Blog post in a static home page’ is closed to new replies.