WordPress.org

Ready to get started?Download WordPress

Forums

Making homepage postIDs accessible by other template (2 posts)

  1. Caneval
    Member
    Posted 1 year ago #

    None of the available plugins do what I need so I am trying to make a 'recent posts column', but I've run into a brick wall.

    I've made two versions: one appears on the homepage and it doesn't display posts (or their IDs) or category-posts appearing elsewhere on that page. The other version appears on a single post page, where it doesn't display the current post ID being displayed, yet shows the latest 5+ posts of all posts, from any category.

    But I want my 'recent posts column' code to work from a single, separate template.

    So, for example, is there a way I can make the homepage's [index.php] post IDs global, so my 'recent posts' column coded in [sidebar.php] can access them, stick them in an array and exclude them?

  2. Caneval
    Member
    Posted 1 year ago #

    There must be a way that this can be done. For example, if on the homepage/index.php I push the posts' IDs into an array called $homeids, how could my recent posts column/sidebar.php template access and exclude $homeids from being displayed?

Topic Closed

This topic has been closed to new replies.

About this Topic