[Resolved] Banner between post

Home Forums Support Banner between post

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #111406
    Tobias

    Hi

    If i would like to add a banner code so a banner is show between every post is that possible? And if what file do i need to edit? Or is it any good add-ons for this?

    #111419
    Jean

    Hey Tobias, you can achieve that doing this:

    I’ll assume that you are using a child theme. So, in the GeneratePress folder, find the file “index.php”, copy and paste into your child theme folder.

    Open the “index.php” and search for this:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>

    Replace for this:

    <?php /* Start the Loop */ ?>
    <?php while ( have_posts() ) : the_post(); ?>
    <?php $count = 1; ?>

    Find this now:
    <?php endwhile; ?>

    Replace for this:

    <?php if ($count == 1) : ?>
    DO YOUR STUFF IN HERE
    <?php endif; $count++; ?>
    <?php endwhile; ?>

    Maybe this could help you mate!

    #111441
    Tom
    Lead Developer
    Lead Developer

    You might be able to achieve this using a function.

    Assuming you want your banner to show up after every single post in your blog/archives etc..

    add_action( 'generate_after_entry_content','generate_insert_banner' );
    function generate_insert_banner()
    { 
          // If we're on a single post, don't do anything
          if ( is_single() )
                return;
    ?>
          Put your banner code in here!
    <?php }

    How to add PHP: http://generatepress.com/knowledgebase/adding-php-functions/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.