Support » Fixing WordPress » Getting to only show on homepage

  • Resolved focusfilm


    So I’m after getting this featured posts widget to only show up on the homepage, as at the moment it causes all kind of bother after page 2 of recent posts. I’ve tried fixing it myself but it breaks the entire homepage.

    Below is the current function, if you could please tell me how I should edit this to do what I want it to.

    <?php if ( $paged < 4 && option::get(‘feat_show’) == ‘on’ ) get_template_part(‘wpzoom’, ‘featured’); ?>

    Any help would be greatly, greatly appreciated as I’m on a time limit. Thanks guys!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Michael


    Forum Moderator

    Sorry I’m rubbish with the wordpress explanations. I can never understand what they’re getting at. If anyone can please just edit that piece of code I’ve provided to do what I want I’d be very grateful. Thanks anyway alchymyth!

    Never mind, just figured it out.

    For anyone else having the same problem, it was a case of creating a new .php file then pasting in that piece of code you only want on the homepage then calling that page template in the index.php file by:

    <?php get_template_part(‘NAME OF TEMPLATE PAGE’); ?>

    wrapped so it looked like this:

    if (is_home() && strpos($_SERVER[‘REQUEST_URI’], “/page/”) === false) {
    ?><?php get_template_part(‘NAME OF TEMPLATE PAGE’); ?><?

    Now it only calls on that template on the home/index page. Hope this is helpful to people having the same problems in the future!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Getting to only show on homepage’ is closed to new replies.