WordPress.org

Ready to get started?Download WordPress

Forums

recent posts in static home page (17 posts)

  1. SCO7TY
    Member
    Posted 1 year ago #

    Hi guys,

    Been searching this all day and although theres a few posts on how to do it I'm struggling to actually implement the suggestions.

    I have set my static home page here - http://www.completemuscleandfitness.com

    Underneath the content i want to add my most recent posts. I have read that i need to add a loop?

    Really struggling with this so i appreciate any help

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Have you reviewed multiple Loops?

  3. SCO7TY
    Member
    Posted 1 year ago #

    Yes, read through a couple of times but i cant get my head around it.

    I found the following in a post from someone trying to achieve something similar to me -

    <?php $my_query = "showposts=3";
    $my_query = new WP_Query($my_query); ?>
    <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
    
    	<!-- standard tags to display blog post information like the_title() here -->
    
    <?php endwhile; // end of one post ?>
    <?php endif; //end of loop ?>
    
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    	<!-- standard tags to display the static page information like the_title() here -->
    
    <?php endwhile; endif; ?>

    I'm not sure where this needs to be placed in my template though, and if anything needs changing?

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    How many recent posts do you wish to show?

  5. SCO7TY
    Member
    Posted 1 year ago #

    Just 5

  6. esmi
    Forum Moderator
    Posted 1 year ago #

    What theme are you using? Do you know what markup your theme uses on it's main posts page?

  7. SCO7TY
    Member
    Posted 1 year ago #

    I'm using elegant themes Polished.

    I'm sorry but i'm not sure what you mean by what markup my themes uses? Still learning a lot.

    I'm sure i could find out though if you can tell me how?

    Thanks for your help..

  8. esmi
    Forum Moderator
    Posted 1 year ago #

    We do not support - or have access to - commercial themes here. You will need to seek any theme specific support from the theme's developer/vendor: http://www.elegantthemes.com/forum/

    The following will work as a starting point - if you change:

    <?php
    $args= array(
    	'posts_per_page' => 5
    );
    $my_query = new WP_Query($args); ?>
    <?php if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post(); ?>
    <!-- standard tags to display blog post information like the_title() here -->
    <?php endwhile; // end of one post ?>
    <?php endif; //end of loop ?>

    But you need to replace <!-- standard tags to display blog post information like the_title() here --> with the actual markup and template tags that are appropriate for your current theme. Otherwise, the code will grab the most recent 5 posts but will not display them. Have you reviewed multiple Loops?

  9. SCO7TY
    Member
    Posted 1 year ago #

    Thanks again for your help. I've already posted in the elegant themes forum and had no response, i generally get better help from here.

    is this what the markup and template tags look like?

    <div class="postcontent">
    <?php $width = (int) get_option('polished_thumbnail_width_pages');
    	  $height = (int) get_option('polished_thumbnail_height_pages');
    	  $classtext = 'post_img';
    	  $titletext = get_the_title();
    
    	  $thumbnail = get_thumbnail($width,$height,$classtext,$titletext,$titletext);
    	  $thumb = $thumbnail["thumb"]; ?>
    
    <?php if($thumb <> '' && get_option('polished_page_thumbnails') == 'on') { ?>
    	<?php print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext , $width, $height, $classtext); ?>
    <?php }; ?>
    <?php the_content(); ?>
    <?php wp_link_pages(array('before' => '<p><strong>'.esc_html__('Pages','Polished').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
  10. esmi
    Forum Moderator
    Posted 1 year ago #

    It looks about right as, as I said, we cant access the theme to check, so all I can suggest is that you try it.

  11. SCO7TY
    Member
    Posted 1 year ago #

    I can provide my blog template php

    http://pastebin.com/tjxQ8eyc

    Can you help from here? I still cant get them to show

  12. esmi
    Forum Moderator
    Posted 1 year ago #

    I'm sorry but we do not support commercial themes here as you paid for support when you bought the theme. It is not our place to keep theme vendors in business.

  13. SCO7TY
    Member
    Posted 1 year ago #

    Theres quite a few posts on this where people have helped out and they had commercial themes.

    I'm not asking to help keep themes vendors in business, i just want some personal help.

    Really wanted to get this sorted :(

  14. Andrew
    Forum Moderator
    Posted 1 year ago #

    If you have a query regarding a theme distributed on WordPress.org, let us know.

  15. SCO7TY
    Member
    Posted 1 year ago #

    Ok if I can't get some help on my current commercial theme then maybe on the following.

    I have been trying for 6 hours now to get my recent posts on a static home page, it's just not going to happen for me.

    Is there another way of setting a page as home page? Obviously as a normal page i can haven page content and the recent posts underneath no problem, and as soon as I set it to static home page the posts disappear.

    Any suggestions?

  16. esmi
    Forum Moderator
    Posted 1 year ago #

    Not without modifying your current theme's template files, no.

  17. naren8642
    Member
    Posted 6 months ago #

    SCO7TY,

    Have you seen this post? That may be what you are looking for, right?

    http://wordpress.org/support/topic/display-most-recent-posts-on-static-homepage-how

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.