different template to page content (4 posts)

  1. danielpol
    Posted 4 years ago #

    Hi, I'm new to wordpress and I need some help.

    I have a website and trying to display the content of pages on home page. Everything ok but i need the content of one page to look different.
    here's what i have

    [Code moderated as per the Forum Rules. Please use the pastebin]

    and for one page i need something like
    <div class="img"> different content </div>

    thanks for any help

  2. Michael
    Forum Moderator
    Posted 4 years ago #

    conditional tags:


    might not work if you are showing multiple pages - then try

    if( $post->ID == 37 )
    where 37 would be the page ID

    depends on the code of your template so far.

  3. danielpol
    Posted 4 years ago #

    I just can't get it to work.

    the code i have.

    Anyone ?

  4. Michael
    Forum Moderator
    Posted 4 years ago #

    with your code, it might be something like this:

    (i have no idea where you want this <div class="img"> different content </div>; if it is instead of the other content, or what. )

    <?php if( $page->ID == 37 ) { ?>
    <div class="img"> different content </div>
    <?php } ?>

    you need to find the page ID of that one page and enter it instead of 37.

    if this is not it, you need to provide more detailed information.

Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.