• heisdnice

    (@heisdnice)


    ok so im editing a single theme file to have it so if the page number is one specific number, it will post a div, but if its any other page it wont post anything.

    here is my coding:

    <?php  if ( is_page('297'))  {
        echo '<div class="content-block widget nopadding">
    <div class="block-title">
    <span>Beat Store</span>
    </div>
    <div class="beatstore ">
    <object type='application/x-shockwave-flash' height='385' width='610' data='https://www.myflashstore.net/widgets/flash/soundstore.swf?user_id=49626'  allowscriptaccess='always'>
    <param name='movie' value='https://www.myflashstore.net/widgets/flash/soundstore.swf?user_id=49626' />
    <param name='menu' value='false' />
    <param name='wmode' value='transparent' />
    <param name='allowscriptaccess' value='always' />
    <param name='flashvars' value='autoplay=0&' />
    </object>
    </div>
    </div>';
    ?>

    but im getting the error:

    Parse error: syntax error, unexpected T_STRING, expecting ',' or ';'

Viewing 4 replies - 1 through 4 (of 4 total)
  • Give this a go:

    <?php  if ( is_page('297') )  { ?>
    
    <div class="content-block widget nopadding">
    <div class="block-title">
        <span>Beat Store</span>
    </div>
    <div class="beatstore">
    <object type='application/x-shockwave-flash' height='385' width='610' data='https://www.myflashstore.net/widgets/flash/soundstore.swf?user_id=49626'  allowscriptaccess='always'>
    <param name='movie' value='https://www.myflashstore.net/widgets/flash/soundstore.swf?user_id=49626' />
    <param name='menu' value='false' />
    <param name='wmode' value='transparent' />
    <param name='allowscriptaccess' value='always' />
    <param name='flashvars' value='autoplay=0&' />
    </object>
    </div>
    </div>
    
    <?php } ?>
    Thread Starter heisdnice

    (@heisdnice)

    i tried it, no more error but the div isnt displaying.

    currently the way my theme is setup it puts my artists in an artists section.
    so the URL would be:

    www.mysitehere.com/artists/pagetitlehere

    i have determined that the post ID for my specific page is 297 because when i go to edit the page the URL says:

    wp-admin/post.php?post=297&action=edit

    is this correct and could the theme be conflicting with this?

    by the way im using this theme:

    https://themeforest.net/item/replay-responsive-music-wordpress-theme/3172436

    esmi

    (@esmi)

    I’m sorry but as you appear to be using a commercial theme, you need to seek support from the theme’s developer/vendor. We do not support commercial products here.

    Michael

    (@alchymyth)

    general:

    https://codex.www.ads-software.com/Function_Reference/is_page

    try to use the page title or page slug in the if statement.

    are you sure it is a static page?

    also try to check the ID directly:

    <?php if ( $post->ID == 297 ) { ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Help with if statement’ is closed to new replies.