Forums

How to link to rss on posts/home page but not other pages (2 posts)

  1. michi2luv
    Member
    Posted 1 year ago #

    Hi, I'm new to wordpress. I am very familiar with Html/css but not php.
    What I'd like to do is display a link (with an image) to my rss feed on my posts page/home page--but not on the other pages. I created a new header.php file called header-noblog.php, which I was going to call in the other pages, but I dont know the code to do it. I also assume there must be an easier way, like if wordpress detected it was the home/posts page it would display it and hide it if not.

    Anyone have any ideas how to do this?

  2. stvwlf
    Member
    Posted 1 year ago #

    Hi

    You can use a conditional tag around any HTML code

    To enter HTML code that will only appear on the home page, you can do this:

    <?php if ( is_home() ) { ?>
        //   put HTML code for "homepage only" here
    <?php } ?>

    You can have as many sections like that as you want.

    Now, you have to learn something about the WordPress templating system, because, while themes can vary in how they are coded, typically the post content for the blog page will be in the theme's index.php file, not in its header.php file. Header.php displays the site header and top navigation. the WordPress loop and post content for a blog/posts page is usually in index.php

    Here is a good page to familiarize yourself with:
    http://codex.wordpress.org/Template_Hierarchy

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags