Forums

How do I override the_content for a specific page? (3 posts)

  1. blogjunkie
    Member
    Posted 2 years ago #

    I'm trying to override the_content with HTML from my functions.php file. I want to:

    1. Check if this is Page X
    2. If it is the correct page, replace the_content with my own code

    Is there a way to do this? Thanks

  2. esmi
    Theme Diva & Forum Moderator
    Posted 2 years ago #

    It would be easier to add the coding to the page template file.

    <?php if( !is_page('X') ) :?>
    [ custom content ]
    <?php else the_content();
    <?php endif;?>
  3. mmond
    Member
    Posted 1 year ago #

    But if this is for a plugin, a template file update is not option correct?

Topic Closed

This topic has been closed to new replies.

About this Topic