Want to move banner to bottom of page on specific posts

That fixed it! Thank you!

We are happy to help,

Cheers!

Ok, so I am trying to do the same thing as above, make a specific banner for a specific post/page, but I’m still a little fuzzy on the coding. So the post id number is ‘2483’ (lose 30 pounds in 30 days). The banner I’ve created for this is named “Lose 30 Pounds Banner”. I tried copying the previous code I have in my theme that was working for post id ‘1832’ (how to lose 20 pounds in a month) and changed the id number and banner name but had zero success. Any help would again be appreciated, thank you.

Hello Brain,

Please take a moment and check this code:

function fitness_banner_2_below_masthead() { ?>
  <?php if ( is_page('1832') ) : ?>
    <div class="custom-shortcode">
	  <?php echo do_shortcode('[rev_slider alias="fitness-banner-2-1"]'); ?>	
    </div>
  <?php endif; ?>
<?php }
add_action('x_after_view_global__slider-below', 'fitness_banner_2_below_masthead');

is_page('1832') condition will check if the “page” has an ID of ‘1832’. The is_page() condition will not work on this page: https://thinkhealthyfitness.com/lose-30-pounds-in-30-days/ because this is a post page. What you need is the is_single() condition for this one.

Have you code updated and use this code:

function thirty_on_thirty_banner_below_masthead() { ?>
  <?php if ( is_single('2483') ) : ?>
    <div class="custom-shortcode">
	  <?php echo do_shortcode('[rev_slider alias="fitness-banner-2-1"]'); ?>	
    </div>
  <?php endif; ?>
<?php }
add_action('x_after_view_global__slider-below', 'thirty_on_thirty_banner_below_masthead');

You may need to change the slider shortcode to display the correct slider.

Kindly let us know how it goes.

Worked out great! I had a question though, where in the world did the code
function thirty_on_thirty_banner_below_masthead() { ?>

come from?

I’m not going to pretend I understand coding the way I wish I should, but the name of the banner is “lose 30 pounds banner”… When I entered in my code originally, the only difference between the code you gave me and the code I entered in was that part… mine originally said …

function lose_30_pounds_banner_below_masthead() { ?>

I guess I’m just wondering where thirty_on_thirty_banner came from?

Either way, thanks for the help lol

Hello Brian,

I gave you this code:

function thirty_on_thirty_banner_below_masthead() { ?>
  <?php if ( is_single('2483') ) : ?>
    <div class="custom-shortcode">
	  <?php echo do_shortcode('[rev_slider alias="fitness-banner-2-1"]'); ?>	
    </div>
  <?php endif; ?>
<?php }
add_action('x_after_view_global__slider-below', 'thirty_on_thirty_banner_below_masthead');

I used a new thirty_on_thirty_banner_below_masthead function name to avoid any conflict with other function names that you may already have. This was, we can prevent any conflicts, issues or misunderstanding.

Hope this helps.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.