WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] How to offset posts by categories in Recent Articles section on my homepage?

[Resolved] How to offset posts by categories in Recent Articles section on my homepage?

  • Right now my homepage has redundancies between featured category posts and the recent articles. I would like to alter my recent articles section so that different articles are visible. I understand that this is possible by adding offset code but I’m not a programmer and need help with this aspect. Is there a way to select which individual articles are visible in the recent articles sections as well? Please see the link to my site below. Also I would like to center the text for the category heading and sidebars. I tried inputing ‘text-align: center;’ and it didn’t work. Please help!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Scott Fennell

    @scofennellgmailcom

    You didn’t link to your site.

    You can try adding this to index.php:

    <?php
    if ( ! is_admin() && $query->is_main_query() && is_home() ) {
    $query->set( ‘offset’, ’10’ );
    }
    ?>

    That should cause your main query to skip the 10 most recent posts.

    here’s my web address: http://www.haute-beauty.com

    Hi, when I added the suggested code to the index.php I got the following error message on my home page. I even went back and removed the suggested code and I still got the same error message. Now my home page is broken. What happened?

    Parse error: syntax error, unexpected T_STRING in /hermes/bosweb/web246/b2467/ipg.hautebeautycom/wp-content/themes/Impulse/includes/recent_articles.php on line 13

    I was able to input my original recent_articles.php and remove the error message. But I still need answers to my original ?’s

    Scott Fennell

    @scofennellgmailcom

    Ah, sorry, I didn’t realize you had no understanding of php.

    You need to get a baseline understanding of how themes work, otherwise you’ll just be copy N pasting with no understanding, which is a waste of everyone’s time. I recommend the excellent “digging into WordPress themes” by Chris Coyier.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] How to offset posts by categories in Recent Articles section on my homepage?’ is closed to new replies.
Skip to toolbar