How to make Twitter Feeds only show on the home page

Discussion in 'NomNom Theme' started by SteveS, Aug 31, 2011.

  1. SteveS Steve

    I want to limit my duplicate content but at the same time pimp out my home page. So I decided to remove the twitter feed from my front page. Here's how I did this.

    I edited this file: NomNom/includes/twitter.php
    PHP:
    ** line ~ 19 after <?php echo $before_widget?> add <?php if(is_home() && !is_paged()) { ?>
    ** line ~ 23 after <?php echo $after_widget?> add <?php ?>
    Now it will only show the twitter feeds on the home page using the "Twenty Eleven Twitter Stream" widget.
  2. SteveS Steve

    <?php if(is_home() && !is_paged()) { ?>
    This will show on the home page only, not page 2, page 3, page 4, etc.

    <?php if(is_home() && !is_paged()) { ?>
    This will show on the home page and paged pages (2,3,4,5, etc)

    <?php if(is_page(category-slug-name)) { ?>
    This will show on the page you want it to show on. You can also do is_category or is_post.
  3. SteveS Steve

    *REQUEST*
    I'd love to see an option in "NomNom Options" (page=nomnom-theme-options) where the twitter feed shows an option to show on every page or on the very first home page only. This will show on the home page only, not page 2, page 3, page 4, etc, or any other pages. It'll help me for future updates so I don't have to edit the file manually every update. I could add this to a plugin but I'm not sure how to write a plugin to make this work.

    Twitter Feed on Front Page Only : Yes/No
    Code Needed
    PHP:
    <?php if(is_home() && !is_paged()) { ?>
    Thanks for the consideration. If I add this to my own plugin to try and overwrite the include I end up getting this error "Cannot redeclare class twentyeleven_Twitter"
    Zeaks likes this.
  4. Zeaks Author

    Thanks for posting this Steve, I'm going to sticky it.

Share This Page