[Support request] Code block appearing on pages other than Home page, when it shouldn’t

Home Forums Support Code block appearing on pages other than Home page, when it shouldn’t

  • This topic has 3 replies, 2 voices, and was last updated 1 week ago by David.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1445695
    Matthew

    Hi. I’m using GP Premium 1.10 at this point, with 2.42 theme and WP 5.5.1.
    I have the following code block in the “After Header” section of GP Hooks:
    —-
    <?php if ( is_front_page() ) : ?>

    <h1>Do You Care About East Lansing?</h1>

    <p style=”font-size: 1.375rem;”>Public Response is a community forum that allows citizens to voice their ideas, concerns, and opinions, and encourages transparency of local government through essays that are submitted.</p>

    <?php do_action(‘mo_optin_form’, ‘uFePSBlGCz’); ?>

    <style>

    .jumbotron {
    color: inherit;
    background-color: #aaa;
    background-blend-mode: multiply;
    background-repeat: no-repeat;
    background-size: cover!important;
    background-position: center 48%;
    padding-bottom: 1.25rem;
    position: relative;
    text-align: center;
    }

    .jumbotron-overlay {
    padding: 1rem 0;
    position: relative;
    z-index: 99;
    }

    .jumbotron h1 {
    color: #fff;
    font-size: 2rem;
    letter-spacing: -1px;
    margin: 0;
    padding: 1rem 0;
    text-shadow: 0 0 8px rgba(0,0,0,.325);
    }

    .jumbotron-container-content {
    color: #fff;
    margin: 0 auto;
    padding: .5rem;
    width: 100%;
    }


    @media
    (min-width: 470px) {
    .jumbotron-container-content {
    width: 84%;
    }
    }

    .link-essays {
    color: #fff !important;
    padding-bottom: 2px;
    border-bottom: 3px solid;
    }

    .link-essays:hover {
    color: #e19251 !important;
    }

    #uFePSBlGCz .gridgum_header2, #uFePSBlGCz .gridgum_headline {
    font-size: 1.125rem;
    }

    #uFePSBlGCz input {
    display: block;
    margin-bottom: .5rem;
    margin-left: auto;
    margin-right: auto;
    }


    @media
    (min-width: 550px) {
    #uFePSBlGCz input {
    display: inline-block;
    }
    }

    #uFePSBlGCz .gridgum_note {
    font-size: .75rem;
    }

    #uFePSBlGCz .mo-optin-error {
    color: #f47149;
    display: none;
    }

    #uFePSBlGCz .mo-optin-fields-wrapper {
    margin-top: 1rem;
    }

    #uFePSBlGCz .mo-optin-form-headline {
    padding: 1rem 0 .5rem 0;
    }

    </style>

    <script type=”text/javascript”>
    jQuery(function($) {
    var images = [‘jumbotron_00.jpg’, ‘jumbotron_01.jpg’, ‘jumbotron_02.jpg’, ‘jumbotron_03.jpg’, ‘jumbotron_04.jpg’, ‘jumbotron_05.jpg’, ‘jumbotron_06.jpg’, ‘jumbotron_07.jpg’, ‘jumbotron_08.jpg’, ‘jumbotron_09.jpg’, ‘jumbotron_10.jpg’, ‘jumbotron_11.jpg’, ‘jumbotron_12.jpg’, ‘jumbotron_13.jpg’];
    $(‘.jumbotron’).css({‘background-image’: ‘url(wordpress/wp-content/uploads/2018/04/’ + images[Math.floor(Math.random() * images.length)] + ‘)’});
    });
    </script>

    <?php endif; ?>
    —-

    So this was (as far as I know) only appearing and still should be appearing on only the home page, but it is now appearing on other (archive) pages on the site. The home page is https://publicresponse.com (where it should appear), but then it’s on pages like https://publicresponse.com/page/2/ .

    Any idea what the problem may be?

    Thank you.

    -Matt Kazmierski

    #1445719
    David
    Staff
    Customer Support

    Hi there,

    use this for your template condition:

    if ( is_front_page() && !is_paged() )

    #1445726
    Matthew

    That worked. Thank you very much David.

    Best,
    Matt

    #1445729
    David
    Staff
    Customer Support
Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.