WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Custom page.php for post & pages (4 posts)

  1. James
    Member
    Posted 1 year ago #

    Hi...I have page template. In that i need to add custom code like if its page need to get the templates else if its post need to get blog post.

    <header>
    is_page() {
    display template....
    post() {
    display blog post/ template...
    <footer>

    Thanks

  2. Beee
    Member
    Posted 1 year ago #

    if ( is_page() )
    {
      // do page action
    }
    else if ( is_single() )
    {
      // post action
    }
    else // if not is_page() or is_single()
    {
     // other action
    }
  3. James
    Member
    Posted 1 year ago #

    Thanks

  4. Beee
    Member
    Posted 1 year ago #

    Could you mark this topic as resolved ?

Topic Closed

This topic has been closed to new replies.

About this Topic