• Hello,

    I’m using the theme named the producer
    https://premium.themolitor.com/?theme=theproducer

    What I would like to achieve is to get rid of the block named div id=”topPanel” only in the contact page, so that the user can see the form without scrolling.

    I know I can do that with CSS, but I’m interested in a clean solution, which would be by writing a condition. Problem is that I don’t know php so I tried to write a condition in the “page.php” file which does not work. Can someone help me please?

    The code I wrote:

    <?php
    if (is_page( contacto )
    
     // Commercial code redacted by a moderator
    
    }
    ?>

Viewing 12 replies - 1 through 12 (of 12 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Your theme’s forums are here: https://www.themolitor.com/forums/

    Thread Starter clemence.izm

    (@clemenceizm)

    Yes but as it is a question that can apply to whatever theme I thought I could recieve some help from the wordpress community…
    Nevermind.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    The safe way would be to create a Child Theme: https://codex.www.ads-software.com/Child_Themes – Then to copy the template file you want to edit and paste it into your Child Theme folder. That way when you make edits to the file those edits won’t be erased when the theme updates.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is “contacto” by the way? Is it a PHP constant?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Also worth looking up the PHP syntax of using IF statements: https://www.php.net/manual/en/control-structures.if.php

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You might find this useful if you can’t spot invalid PHP, or aren’t using an IDE that spots it for you: https://www.piliapp.com/php-syntax-check/

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    If you were getting a blank white page and couldn’t see anything informative then contact your hosting providers and ask them to show you your site’s error logs, for more information about the issue.

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    Have you seen that Codex article about Conditional Tags? It has good examples: https://codex.www.ads-software.com/Conditional_Tags#Working_Examples

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    so that the user can see the form without scrolling.

    So you’re aiming this change at users on an exact screen size?

    Thread Starter clemence.izm

    (@clemenceizm)

    Hello,
    thank′s for your answers, I’ll check the documentation you provided and hope to find the solution.

    Contacto is the name of the page contact, the one I want to customize by removing the div.

    so that the user can see the form without scrolling.

    I mean that, as I will remove the div id=”topPanel”, the user will see directly the contact form located in the next div id=”mainPanel”, no matter the screen size.

    I saw that the code I shared has been cut, so I will write it again with less details. The idea is to display in the contact page the divid=”mainPanel”, and in the others pages both id=”topPanel” and id=”mainPanel”. I’ve wrote this code in the page.php file and a blank page displays (yes I work on child theme):

    <?php
    if (is_page( contacto ){
    ?>
    <div id=”mainPanel”> </div>
    <?php
    }
    ?>
    <?php
    else {
    ?>
    <div id=”topPanel”> </div>
    <div id=”mainPanel”> </div>
    <?php
    }
    ?>

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    It still looks like you’re using a constant of “contacto”, doesn’t it need to be a string?

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What’s your error saying?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘How to remove a block from contact page?’ is closed to new replies.