WordPress.org

Ready to get started?Download WordPress

Forums

insert conditional paypal button into sidebar (3 posts)

  1. souleye
    Member
    Posted 1 year ago #

    I'm trying to insert a paypal button to show only on one page. I did it successfully with one theme, now, I'm using grey opaque theme, but it's not working. I'm not sure what I'm doing wrong. the page id is 5, so here's the code.

    <?php if ( !is_page(5) ) : else : ?>
    
    				<div class="paypal">
    				<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    -- paypal code goes here ---
    </form>
    
    				</div> <?php endif; ?>

    [Moderator Note: Please post code or markup snippets between backticks or use the code button. As it stands, your code may now have been permanently damaged/corrupted by the forum's parser.]

  2. esmi
    Forum Moderator
    Posted 1 year ago #

    Try:

    <?php if ( is_page(5) ) :?>
    <div class="paypal">
    <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
    -- paypal code goes here ---
    </form></div> <?php endif; ?>
  3. souleye
    Member
    Posted 1 year ago #

    I think the paypal code is correct. it's working perfect on another site. I believe the cause should be on what comes before:
    if(!dynamic_sidebar('primary-widget-area')) : ?>
    I've never been able to understand what that means

Topic Closed

This topic has been closed to new replies.

About this Topic