• Resolved vikonic

    (@vikonic)


    Hello there, I’m trying to pull off something interesting here and I’m stuck. Let me begin by saying I am by no means a coder and my PHP experience is 0. I am pretty good with xhtml and css though.

    Anyways, I have an index.php page, that displays the homepage of my website. Banner, navigation, etc is all located here. What I would like is to feed the ‘latest # of posts’ into the news <div> tag, which I think I already know how to do. Problem is that I also want to feed another piece of information such as Top 10 Songs, that would get updated frequently, into my sidebar.

    What would be the simplest way to create a ‘top 10’ page in WP and then feed it over into a <div> tag in my sidebar?

    Sorry if it sounds confusing, I’ll simplify as needed.

    Thanks.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The simples way? Put it in the template. Another way would be to “inject” an external file.

    Let’s say you have a html-snippet with your top-10 stored in a file called “top10.txt”, then you can use php to “read and inject” it into the page like this:

    <?php echo(file_get_contents('./top10.txt')); ?>

    You could categorize the posts in different categories when you post them,(say “songs” and “events”) and then call for the “songs” in one DIV and “events” in the other DIV.

    Thread Starter vikonic

    (@vikonic)

    Wow, very useful reply guys, thanks a lot. I’m marking this one solved ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to feed WP data to the main index.php page’ is closed to new replies.