• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Add Same Content to the Bottom of Every Post – HOW?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Add Same Content to the Bottom of Every Post – HOW?

This topic is: resolved

Tagged: custom function

  • This topic has 5 replies, 3 voices, and was last updated 5 years, 4 months ago by Roadturn.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • November 12, 2017 at 2:24 pm #213503
    Roadturn
    Participant

    I want to include the same content (sentence plus a link) to the bottom of every post. What's the best way to automate that? The themes will vary, but all are StudioPress and Genesis.

    November 12, 2017 at 3:28 pm #213506
    Brad Dalton
    Participant

    Use a custom function with hook and conditional tag

    In your case, the genesis_entry_footer hook and is_singular('post')) conditional tag.


    Tutorials for StudioPress Themes.

    November 12, 2017 at 3:46 pm #213507
    oijohn
    Member

    Add this to functions.php

    //* Register widget areas
    genesis_register_sidebar( array(
    'id' => 'after-entry',
    'name' => __( 'After Entry', 'theme-prefix' ),
    'description' => __( 'This is the after entry section.', 'theme-prefix' ),
    ) );
    //* Hooks after-entry widget area to single posts
    add_action( 'genesis_entry_footer', 'my_after_entry_widget' );
    function my_after_entry_widget() {
    if ( ! is_singular( 'post' ) )
    return;
    genesis_widget_area( 'after-entry', array(
    'before' => '<div class="after-entry widget-area"><div class="wrap">',
    'after' => '</div></div>',
    ) );
    }

    Then you will want to style it.

    add this to style.css

    /* After Entry
    --------------------------------------------- */
    .after-entry {
    background-color: #ddd;
    border-bottom: 1px solid #222;
    border-top: 2px solid #222;
    margin-top: 40px;
    margin-top: 4rem;
    padding: 30px 0;
    padding: 3rem 0;
    }
    .after-entry p:last-child {
    margin-bottom: 0;
    }
    .after-entry .widget {
    margin-bottom: 30px;
    margin-bottom: 3rem;
    }
    .after-entry .widget:last-child {
    margin-bottom: 0;
    }

    Then your good to go. You may want to change styling slightly all the best.

    November 12, 2017 at 5:19 pm #213511
    Roadturn
    Participant

    Thank you, guys. Do I use the Genesis Hooks plugin for that?

    November 12, 2017 at 5:24 pm #213513
    Brad Dalton
    Participant

    Also, don't forget there's a built in after entry widget already coded into Genesis https://gist.github.com/studiopress/bcef7e095393596cf67d#file-after-entry-widget-php


    Tutorials for StudioPress Themes.

    November 12, 2017 at 6:08 pm #213514
    Roadturn
    Participant

    Just saw that, Brad. Gotta wake up here. Thank you.

  • Author
    Posts
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Add Same Content to the Bottom of Every Post – HOW?’ is closed to new replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble